You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Benoit Mouquet <bm...@excilys.com> on 2015/10/20 18:41:21 UTC
LoggerContext is reloaded on application shutdown
Hello everyone,
I send you a mail because I'm currently try to integrate log4j2 in new
project (Java web application, spring, hibernate ...).
I have configured my dependency (I use SLF4J with Log4j2 and the module
Log4j2-web) and create my log4j2.xml file and all seems to work properly.
The only problem is that my LoggerContext is reloaded when I close my Jetty
server (shutdown first and start again). You can see it in the log.txt
file. I don't understand why this occurs. Is it a normal behavior ? How I
can avoid this ?
Thanks in advance,
--
Benoit Mouquet
Re: LoggerContext is reloaded on application shutdown
Posted by Benoit Mouquet <bm...@excilys.com>.
You are right Ralph, I discover that Spring use my LoggerContext after it
has ended.
I think it's because Spring is loaded before Log4j2 (and also unloaded
after). I will look if I can find a solution to avoid this problem.
2015-10-20 20:47 GMT+02:00 Ralph Goers <ra...@dslextreme.com>:
> It happens because something is trying to log something after the
> LoggerContext has ended. Whatever that is needs to happen before the
> logging system is shut down.
>
> Ralph
>
> > On Oct 20, 2015, at 11:16 AM, Benoit Mouquet <bm...@excilys.com>
> wrote:
> >
> > Exactly, that's why I don't understand what's happen in my application.
> > Indeed, when I shutdown my webapp, the LoggerContext is stop first but
> > restart just after (and not stop again). The normal behavior should be
> > that the LoggerContext it stop and that's all (not start again during the
> > shutdown). Or maybe I missing something ...
> >
> > 2015-10-20 19:48 GMT+02:00 Jochen Wiedmann <jo...@gmail.com>:
> >
> >> This is quite as it should. If the webapp is being shutdown, then all
> >> acquired resources (including the logging system) are to be released.
> >> You'd end up with a resource leak otherwise. Why do you expect log4j
> >> to be an exception?
> >>
> >> Jochen
> >>
> >>
> >> On Tue, Oct 20, 2015 at 6:41 PM, Benoit Mouquet <bm...@excilys.com>
> >> wrote:
> >>> Hello everyone,
> >>>
> >>> I send you a mail because I'm currently try to integrate log4j2 in new
> >>> project (Java web application, spring, hibernate ...).
> >>>
> >>> I have configured my dependency (I use SLF4J with Log4j2 and the module
> >>> Log4j2-web) and create my log4j2.xml file and all seems to work
> properly.
> >>> The only problem is that my LoggerContext is reloaded when I close my
> >> Jetty
> >>> server (shutdown first and start again). You can see it in the log.txt
> >> file.
> >>> I don't understand why this occurs. Is it a normal behavior ? How I can
> >>> avoid this ?
> >>>
> >>>
> >>> Thanks in advance,
> >>>
> >>> --
> >>> Benoit Mouquet
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >>
> >>
> >> --
> >> The next time you hear: "Don't reinvent the wheel!"
> >>
> >>
> >>
> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >>
> >
> >
> > --
> > Benoit Mouquet
> > Tel : 06 40 19 13 62
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
Benoit Mouquet
Tel : 06 40 19 13 62
Re: LoggerContext is reloaded on application shutdown
Posted by Ralph Goers <ra...@dslextreme.com>.
It happens because something is trying to log something after the LoggerContext has ended. Whatever that is needs to happen before the logging system is shut down.
Ralph
> On Oct 20, 2015, at 11:16 AM, Benoit Mouquet <bm...@excilys.com> wrote:
>
> Exactly, that's why I don't understand what's happen in my application.
> Indeed, when I shutdown my webapp, the LoggerContext is stop first but
> restart just after (and not stop again). The normal behavior should be
> that the LoggerContext it stop and that's all (not start again during the
> shutdown). Or maybe I missing something ...
>
> 2015-10-20 19:48 GMT+02:00 Jochen Wiedmann <jo...@gmail.com>:
>
>> This is quite as it should. If the webapp is being shutdown, then all
>> acquired resources (including the logging system) are to be released.
>> You'd end up with a resource leak otherwise. Why do you expect log4j
>> to be an exception?
>>
>> Jochen
>>
>>
>> On Tue, Oct 20, 2015 at 6:41 PM, Benoit Mouquet <bm...@excilys.com>
>> wrote:
>>> Hello everyone,
>>>
>>> I send you a mail because I'm currently try to integrate log4j2 in new
>>> project (Java web application, spring, hibernate ...).
>>>
>>> I have configured my dependency (I use SLF4J with Log4j2 and the module
>>> Log4j2-web) and create my log4j2.xml file and all seems to work properly.
>>> The only problem is that my LoggerContext is reloaded when I close my
>> Jetty
>>> server (shutdown first and start again). You can see it in the log.txt
>> file.
>>> I don't understand why this occurs. Is it a normal behavior ? How I can
>>> avoid this ?
>>>
>>>
>>> Thanks in advance,
>>>
>>> --
>>> Benoit Mouquet
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>>
>> --
>> The next time you hear: "Don't reinvent the wheel!"
>>
>>
>> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
> --
> Benoit Mouquet
> Tel : 06 40 19 13 62
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: LoggerContext is reloaded on application shutdown
Posted by Benoit Mouquet <bm...@excilys.com>.
Exactly, that's why I don't understand what's happen in my application.
Indeed, when I shutdown my webapp, the LoggerContext is stop first but
restart just after (and not stop again). The normal behavior should be
that the LoggerContext it stop and that's all (not start again during the
shutdown). Or maybe I missing something ...
2015-10-20 19:48 GMT+02:00 Jochen Wiedmann <jo...@gmail.com>:
> This is quite as it should. If the webapp is being shutdown, then all
> acquired resources (including the logging system) are to be released.
> You'd end up with a resource leak otherwise. Why do you expect log4j
> to be an exception?
>
> Jochen
>
>
> On Tue, Oct 20, 2015 at 6:41 PM, Benoit Mouquet <bm...@excilys.com>
> wrote:
> > Hello everyone,
> >
> > I send you a mail because I'm currently try to integrate log4j2 in new
> > project (Java web application, spring, hibernate ...).
> >
> > I have configured my dependency (I use SLF4J with Log4j2 and the module
> > Log4j2-web) and create my log4j2.xml file and all seems to work properly.
> > The only problem is that my LoggerContext is reloaded when I close my
> Jetty
> > server (shutdown first and start again). You can see it in the log.txt
> file.
> > I don't understand why this occurs. Is it a normal behavior ? How I can
> > avoid this ?
> >
> >
> > Thanks in advance,
> >
> > --
> > Benoit Mouquet
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
> --
> The next time you hear: "Don't reinvent the wheel!"
>
>
> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
Benoit Mouquet
Tel : 06 40 19 13 62
Re: LoggerContext is reloaded on application shutdown
Posted by Jochen Wiedmann <jo...@gmail.com>.
This is quite as it should. If the webapp is being shutdown, then all
acquired resources (including the logging system) are to be released.
You'd end up with a resource leak otherwise. Why do you expect log4j
to be an exception?
Jochen
On Tue, Oct 20, 2015 at 6:41 PM, Benoit Mouquet <bm...@excilys.com> wrote:
> Hello everyone,
>
> I send you a mail because I'm currently try to integrate log4j2 in new
> project (Java web application, spring, hibernate ...).
>
> I have configured my dependency (I use SLF4J with Log4j2 and the module
> Log4j2-web) and create my log4j2.xml file and all seems to work properly.
> The only problem is that my LoggerContext is reloaded when I close my Jetty
> server (shutdown first and start again). You can see it in the log.txt file.
> I don't understand why this occurs. Is it a normal behavior ? How I can
> avoid this ?
>
>
> Thanks in advance,
>
> --
> Benoit Mouquet
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
--
The next time you hear: "Don't reinvent the wheel!"
http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org