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 James Stauffer <st...@gmail.com> on 2005/01/21 20:31:33 UTC
multiple web-apps in separate logging contexts
I did the first two steps in examples\tiny-webapp\INSTALL.txt:
log4j.jar in common/lib
added -Dlog4j.repositorySelector=JNDI to command line
I didn't see the following in the output:
*** Will use ContextJNDISelector **
Should I see that after just those two steps (and restart tomcat)?
--
James Stauffer
http://www.geocities.com/stauffer_james/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Ceki Gülcü <ce...@qos.ch>.
James,
Are you seeing any other log4j related messages? If you are, then you
should see "Will use ContextJNDISelector" message on the console which is
redirected by Tomcat to ./logs/catalina.out.
Otherwise, are you sure that -Dlog4j.repositorySelector=JNDI is placed on
the right spot in catalina.sh or catalna.bat?
Are you using 1.3alpha-6?
At 08:31 PM 1/21/2005, you wrote:
>I did the first two steps in examples\tiny-webapp\INSTALL.txt:
>log4j.jar in common/lib
>added -Dlog4j.repositorySelector=JNDI to command line
>
>I didn't see the following in the output:
>*** Will use ContextJNDISelector **
>
>Should I see that after just those two steps (and restart tomcat)?
>
>--
>James Stauffer
>http://www.geocities.com/stauffer_james/
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Ceki Gülcü <ce...@qos.ch>.
At 07:45 PM 1/22/2005, Jacob Kjome wrote:
>At 06:49 PM 1/22/2005 +0100, Ceki Gulcu wrote:
> >In 1.3, you can detach a repository by name. In 1.2.x you cannot. So,
> >when your web-app is recycled you can shutdown and detach it whereas
> >in 1.2 your repository will not be recycled along with your
> >web-app. See also [1] o.a.l.selector.servlet.ContextDetachingSCL.
> >
>
>It should be shut down upon webapp shutdown using LogManager.shutdown(),
>which InitContextListener does. It just doesn't do it by name. If you
>call LogManager.shutdown(), it should shut down the current logger
>repository, right? I haven't looked at this code lately in 1.3, but it
>should do the same thing without needing to know the name of the current
>logger repository. It might be nice to know for logging purposes, but why
>is it needed?
Good question. When recycling a web-app, the idea is to allow the app
server to garbage collect the class loader associated with the stale
version of the web-application. Removing the reference from the map managed
by the selector is safer way to ensure garbage collection than shutting
down the repository. However, if the shutdown method in Hierarchy is
totally bug free then the two forms should be equivalent (me thinks).
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Jacob Kjome <ho...@visi.com>.
At 06:49 PM 1/22/2005 +0100, you wrote:
>At 05:02 PM 1/22/2005, you wrote:
>>At 07:06 PM 1/21/2005 -0600, you wrote:
>> >So for 1.2 I need to use a custom repository selector from the sandbox
>> >and in 1.3 there is one available in the core. Is that correct?
>>
>>Yup!
>
>But there are other differences. In 1.3, the "log4j.repositorySelector"
>system property is processed by LogManager, in 1.2.x that system
>property has no effect.
Good point to make note of. However, using the InitContextListener from
logging-log4j-sandbox takes care of this for any given webapp. It sets the
repository selector, if it hasn't already been set, with the users
preferred repository selector provided as a context param in the web.xml
file. It also has some other nice functionality which might be of use to
people. See the javadoc for info.
> Moreover, in 1.3, ContextJNDISelector will
>also configure your named repository when it creates it. In 1.2, it
>will just create it leaving to you the responsibility of configuring
>it.
Which InitContextListener also takes care of.
>
>In 1.3, you can detach a repository by name. In 1.2.x you cannot. So,
>when your web-app is recycled you can shutdown and detach it whereas
>in 1.2 your repository will not be recycled along with your
>web-app. See also [1] o.a.l.selector.servlet.ContextDetachingSCL.
>
It should be shut down upon webapp shutdown using LogManager.shutdown(),
which InitContextListener does. It just doesn't do it by name. If you
call LogManager.shutdown(), it should shut down the current logger
repository, right? I haven't looked at this code lately in 1.3, but it
should do the same thing without needing to know the name of the current
logger repository. It might be nice to know for logging purposes, but why
is it needed?
>These are small differences but which sometimes can add up to make a big
>difference.
>
repository selectors work nicer in 1.3, but I'm not sure a big difference
will be seen by an end user using Log4j-1.3 -vs- using Log4j-1.2 + sandbox
utilities.
>[1] http://tinyurl.com/3vpm8
>
>Oh, and I forgot to mention the internal logs generated by log4j itself.
>
Yes, that's certainly nice, but is a bit tangential to the current
question. I'm certainly not advocating using 1.2 over 1.3. I'm just
making it known that using repository selectors is possible in 1.2.
Jake
>>Jake
>
>--
>Ceki Gülcü
>
> The complete log4j manual: http://www.qos.ch/log4j/
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Ceki Gülcü <ce...@qos.ch>.
At 05:02 PM 1/22/2005, you wrote:
>At 07:06 PM 1/21/2005 -0600, you wrote:
> >So for 1.2 I need to use a custom repository selector from the sandbox
> >and in 1.3 there is one available in the core. Is that correct?
>
>Yup!
But there are other differences. In 1.3, the "log4j.repositorySelector"
system property is processed by LogManager, in 1.2.x that system
property has no effect. Moreover, in 1.3, ContextJNDISelector will
also configure your named repository when it creates it. In 1.2, it
will just create it leaving to you the responsibility of configuring
it.
In 1.3, you can detach a repository by name. In 1.2.x you cannot. So,
when your web-app is recycled you can shutdown and detach it whereas
in 1.2 your repository will not be recycled along with your
web-app. See also [1] o.a.l.selector.servlet.ContextDetachingSCL.
These are small differences but which sometimes can add up to make a big
difference.
[1] http://tinyurl.com/3vpm8
Oh, and I forgot to mention the internal logs generated by log4j itself.
>Jake
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Jacob Kjome <ho...@visi.com>.
At 07:06 PM 1/21/2005 -0600, you wrote:
>So for 1.2 I need to use a custom repository selector from the sandbox
>and in 1.3 there is one available in the core. Is that correct?
Yup!
Jake
>
>--
>James Stauffer
>http://www.geocities.com/stauffer_james/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by James Stauffer <st...@gmail.com>.
So for 1.2 I need to use a custom repository selector from the sandbox
and in 1.3 there is one available in the core. Is that correct?
--
James Stauffer
http://www.geocities.com/stauffer_james/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Jacob Kjome <ho...@visi.com>.
Well, the description that Ceki and I have been giving assume
1.3. However, you can still use a repository selector with 1.2.x. It's
just more formalized in 1.3. See...
http://wiki.apache.org/logging-log4j/AppContainerLogging
Oh, and check out the 0.3 alpha tag (or something like that) from
logging-log4j-sandbox to get code compatible with 1.2.x.
Jake
At 05:10 PM 1/21/2005 -0600, you wrote:
>I am using 1.2.9. Does it only work with 1.3? I am using my own apps.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by James Stauffer <st...@gmail.com>.
I am using 1.2.9. Does it only work with 1.3? I am using my own apps.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: multiple web-apps in separate logging contexts
Posted by Jacob Kjome <ho...@visi.com>.
Are the loggers created for your application in the "default" logger repository
or the "hello" or "tata" logger repository? There's some extra Log4j debugging
that will be removed in the final version of 1.3 that tells you this.
Jake
Quoting James Stauffer <st...@gmail.com>:
> I did the first two steps in examples\tiny-webapp\INSTALL.txt:
> log4j.jar in common/lib
> added -Dlog4j.repositorySelector=JNDI to command line
>
> I didn't see the following in the output:
> *** Will use ContextJNDISelector **
>
> Should I see that after just those two steps (and restart tomcat)?
>
> --
> James Stauffer
> http://www.geocities.com/stauffer_james/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org