Re: [log4j][log4j-web] Start and Stop Order?

Ralph Goers <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <[email protected]>
Interesting that you posted this to the user list.

Last I checked the way the shutdown worked was very much dependent on which servlet spec version the app is using. As I recall, prior to 3.0 a servlet filter had to be directly configured by the user. Configuring that in the web.xml as the first filter pretty much guaranteed proper ordering. With 3.0 I believe a ServletContainerInitializer is used instead to register the filter. I believe the ordering of that is only guaranteed if Log4j’s ServletContainerInitializer is called before any others. 

Ralph

> On Feb 24, 2021, at 7:20 AM, Gary Gregory <[email protected]> wrote:
> 
> Hi All:
> 
> I have a bug in a web app where I use log4j-web:
> - Tomcat 9 correctly starts Log4j 2 FIRST, BEFORE the web-app, which is correct.
> - The App runs and uses Log4j 2
> - When I stop or undeploy the web app, Tomcat complains about a Log4j
> thread still hanging around because:
> - Tomcat stops Log4j FIRST (which is wrong for this stack).
> - Tomcat stops the web-app which cause some logging
> - Log4j re-initializes itself
> 
> So... Can we fix this in our web fragment? Can we say "start first and
> stop last"?
> 
> Can I say that at all in server.xml? Does Servlet 5.0 (Tomcat 10) help?
> 
> TY!
> Gary
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.