We're using Log4J in a medium-sized Webapp, along with Struts and other stuff.
I defined a "Logger" Facade that isolates the code base from Log4J; were we to ever switch logging packages, it'd be a snap. Basically it calls through to the Category methods. The Facade does the initialization also. BTW if you can use the XML configuration format, by all means do, it's much easier to set up and maintain than the property file. At the top of each action class we have: private static final Logger log = Logger.getInstance(MyAction.class); then we do: log.warn("some harmless error occurred", exception); It's very much the same thing. --Renaud ----- Original Message ----- From: "Alex Colic" <[EMAIL PROTECTED]> To: "Log4j" <[EMAIL PROTECTED]> Sent: Friday, October 19, 2001 1:32 PM Subject: How to properly use log4j with servlets. > Hi, > > I am trying to figure out how to use Log4J with servlets. Presently at the > top of each class I have: > > private static Category cat = > Category.getInstance(wrEstimatedValuesAction.class.getName()); > > Then throughout the class I use: > > if(cat.isInfoEnabled) > { > > } > > Questions: > > 1: Lets say you have a lot of servlets, does each servlet load the > logsettings.properties file? > 2: I am using Struts with the servlets, anyone have experience using Log4J. > Examples, ideas? > > Thanks for any info. > > Regards > > Alex > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]