tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <boris.unckel....@gmx.net>
Subject Re: per-webapp logging problem with Tomcat 5.5
Date Mon, 27 Feb 2006 10:46:41 GMT
Hello Andreas,

I have read your response to Remy's mail.

> >> Could it be that all libraries I use go to the wrong log?
> > 
> > This depends on the common and shared classloader. Please put any JAR 
> > which is not delivered by Tomcat and already there in a default 
> > installation in your
> > WEB-INF/lib folder. Test again.
> 
> I don't understand. The jars I've put into common/lib are:
> 
> - database driver, dbcp... as I am using DataSource injection via JNDI, 
> it is not recommended to add database drivers to the application itself 
> (it should remain independant of the actual database used.
> 
> - javamail... same, I am using JNDI for that. Also, javamail does not 
> log in non-debug mode AFAIK.
> 
> - JSTL... I could move them to the application (actually it belongs 
> there until J2EE 5.0), but they don't do any logging at all.
Hm, seems ok, you do not have any problems with their logs.

> 
> The libraries whose logging goes to the wrong log are already all in my 
> application (e.g. Spring & Hibernate).
> 
> > If that does not help: It may also be usefull to have a 
> > logging.properties per webapp (put it into WEB-INF/classes)
> 
> This is not an option, as I would have to hardcode my applications 
> loglevels. This is something the deployer will do, and he may not change 
> the application.
The logger instances are provided by ThreadContextClassloader(TCCL). The
configuration is also read by context.
You want to have a _one_ central place for your log configuration _and_ the
correct logging just for that application - currently impossible.

Think of a spring/hibernate class: org.springhibernate.somepackage.Util
You want to configure for the whole package
org.springhibernate.somepackage.level=FINEST
org.springhibernate.somepackage.handlers=1app1.somehandler

Now you want to configure the second app
2org.springhibernate.somepackage.handlers=1app1.somehandler,
2app2.somehandler

With the first sample you would have the log of app1 *and* app2 in one file.

With the second sample you would have the log of app1 *and* app2 in both
files.

I think this is not your goal - you want to have app1 in logfile1 and app2
in logfile2.

If you specify the logging.properties per webapp you can reach your goal.

Why:
In app1
org.springhibernate.somepackage.Util makes an
LogFactory.getLog(org.springhibernate.somepackage.Util.class) call to obtain
an instance. It gets one instance bound to the TCCL of the webapp.
If you have no logging.properties specified, you will not have an
independent but the global config. If app2 aquires an instance with the same
name (org.springhibernate.somepackage.Util) it gets another instance but the
same config and with the same handlers.

Regards
Boris

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


Mime
View raw message