Hey Log4j 2 dev guys !
Appreciate your work on this cool stuff !

We want to switch entire tomcat (I mean tomcats internal logs and logs of web 
apps)  to Log4j2. And have only one log file for tomcat logs and web app logs 
(We are using embedded tomcat so it's a case when we have only one app per 
tomcat)

It looks possible :

-          Add jul to slf bridge (as I know tomcat uses jcl which is by default 
tied to jul(i) in tomcat )

-          Add slf to log4j2 bridge

The only issue (that I see =) ) it's proper initialization of log4j2.
Log4j2 should be initialized at the very first steps of tomcats startup. So for 
example - It should be initialized in LifecycleListener-> 
Lifecycle.BEFORE_START_EVENT.

But the default initialization is supposed to be used on servlet initialization 
level. But it's too late.

My idea was just to copy init code from Log4jServletContextListener but it uses 
ServletContextEvent to get some additional information.

So my question is :
                Is it possible somehow init Log4j2 at the first steps of 
tomcats startup and have only one log file for all logs from tomcat internal 
stuff and web app that is deployed to that tomcat.

Thank you very much for your answer !!!

Reply via email to