Commons-logging is a wrapper. Try use log4j or jdk 1.4 logger for the
underlying logger

-----Original Message-----
From: Tim Shaw [mailto:[EMAIL PROTECTED] 
Sent: June 4, 2003 1:42 PM
To: Tomcat Users List
Subject: Logging help please

Hi,

Does anyone have a link to a FAQ or HOW-TO for using commons-logging 
with Tomcat 4.1.x please? I've read the obvious ones at apache.org and 
sun.com, and tried all sorts before having to back out and go to a 
wrapper around ServletContext.log (which doesn't give me levels and 
files etc). I was hoping to use the JDK14 Logger FileLogger.

I'd appreciate a sanity check on the below - thanks for your time.

I have 4 co-operating web apps, each of which extends their Controller 
servlet from a class in a common jar file (deployed in WEB-INF/lib with 
each app).

I would like to be able to 'tune' (outside the .war file) the logging 
levels, filenames etc.

Modifying the $JAVA_HOME/jre/lib/logging.properties file seems to make 
no difference (and seems as if it would be 'global').

I tried loading a log properties file using loadResourceAsStream in the 
Controller super-class - which seems better (in that it does some of the 
logging, but I can't seem to get it to log 'finer' than INFO). This also 
creates multiple log files (following the pattern xxxx%u.log as per JDK 
1.4 logging). I am happy to provide the properties file-name in the 
web.xml as an init parameter - seems sound.

Class Loading etc. :

For singletons (e.g. the Controller servlet super-class instances), I 
would assume that initialising the log as a static variable would result 
in different Factories for each app as it is a different class-loader.

When I have multiple instances of a class, however, (I'm using 
Command/Action pattern) should I use a static variable (write contention 
causes the multiple files mentioned above?)? Is there a distinction 
between logging to multiple instances of the  FileLogger as opposed to a 
single instance? Is there a reason to optimise the calls to get a Logger 
from the Factory - or is it OK to just grab one as and when?

Sorry for the length.

Regards

tim





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to