We have Log4j packaged within the WAR for each of the deployed applications. 
Under run-time configuration I mean editing the standard log4j.xml which is 
re-read by Tomcat. (I.e. we do not want to reimplement any log level 
configuration in servlet configuraton, what we  want is to pass the location of 
that log4j file outside the WAR and be able to change this location without 
touching the webapps directory, otherwise we will lose it with redeployment.)

What worked perfectly is the log4jConfigLocation context-param in the web.xml. 
As far as I understand this mechanism comes from Spring (class 
Log4jWebConfigurer), which is fine, as all our applications use Spring.

What does not work is to override log4jConfigLocation from the 
conf/.../myapp.xml context file (after Tomcat copies it there) using the 
Parameter element. Anyone experience with this exact problem? Or, how to debug 
it?

> Date: Wed, 10 Sep 2014 16:58:08 -0700
> From: its_toas...@yahoo.com.INVALID
> To: users@tomcat.apache.org
> Subject: Re: Context parameter override?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Chris,
> 
> On 9/10/2014 4:48 PM, Christopher Schultz wrote:
> > Mark,
> > 
> > On 9/10/14 6:45 PM, Mark Eggers wrote:
> >> Responses inline.
> > 
> >> On 9/10/2014 1:33 PM, sbre...@hotmail.com wrote:
> >>> I am pretty sure I tried option 3 and Log4j initialization did
> >>>  ignore my log4jConfigLocation setting in conf/.../myapp.xml.
> > 
> >> Oh heck, I think I see what you're trying to do. And this isn't 
> >> going to work for multiple web applications, since it's a SYSTEM 
> >> property.
> > 
> >> This means you get 1 value for the JVM. The following web page 
> >> illustrates this:
> > 
> >> http://logging.apache.org/log4j/1.2/manual.html
> > 
> > If the OP is using log4j with multiple web applications and wants
> > to have log4j.jar at the Tomcat level instead of at the webapp
> > level, then log4j 2.x is what he wants: it's got much better
> > support for things like multiple ClassLoaders, etc.
> > 
> > Using default initialization for log4j is just a Bad Idea in
> > general.
> > 
> > -chris
> > 
> 
> Agreed. However since the original poster is running under Tomcat 6, I
> went ahead and assumed (insert appropriate comment here) that the
> included library was 1.2.x.
> 
> If it's 2.x, then my comments should be factored accordingly.
> 
> So B, which version of log4j is being included in your applications?
> Are you using one log4j JAR in $CATAINA_HOME/lib (or $CATALINA_BASE/lib)?
> 
> . . . discovery, it's not just for breakfast anymore
> /mde/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.13 (MingW32)
> 
> iQEcBAEBAgAGBQJUEOWQAAoJEEFGbsYNeTwtXmUH/3HrbaTGrvgSGdY7lWZk/I/y
> 6LKBNWyxVSHkdn4XhIJryDd1h6UihnA90Z+3UlOwc3jyKh95zdlqYj32cDs+tEeQ
> Qlhjz7UlT5JYPRVjp4ksK/PQ6S9sgFefB+gXWABVBsawlpy0f/tiWknKuMyGVGFM
> eEEX+aghV/hj6qI8u31KyaxwCjnxv4E+EQ+hBZ5ZkW/ElmNlMf1gI/uF+sDAL2LI
> eQ/1MD24DzkpU/lJZ0nCbj3L+YwP+lACOQlyZW8ptHSHgnGLwcW8Se+JrHF09/qD
> wmmOkXyNtKXiFj2wvCwF49Wle1FcCCmOJqUj4e9zTiAf5jlIjtfkPNLQ7wXkqYY=
> =PVAv
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
                                          

Reply via email to