On May 20, 2013, at 10:56 AM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Nick,
> 
> On 5/19/13 11:25 AM, Nick Williams wrote:
>> Unfortunately, requiring users to call System.gc() before shutdown
>> for logging to work properly is no better than requiring users to
>> register a listener in a web application for logging to work
>> properly. Surely there's a better way...
> 
> Do you initialize your logging system in a ServletContextListener (or
> similar)? If so, then you should destroy it at the same level.
> 
> If you aren't initializing your logging system in a
> ServletContextListener... then how are you initializing it?
> 
> Long ago, I abandoned log4j's auto-initialization primarily because it
> sometimes guesses wrong.

First, remember that this is Log4j 2, so things are obviously different.

Log4j initializes with the first call to LogManager#getLogger(), whenever that 
occurs. In my case loggers are static, so it happens when the classes are 
initialized. In the specific case of the replication project attached to the 
issue, it happens on the first request to the only Servlet in the application.

Unfortunately, I've just about given up on it being possible to make logging 
work "right" without a ServletContextListener. Man oh man did I want to avoid 
that...

Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to