Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Mufaddal Khumri
Hi, Am new to log4j. Am using Tomcat 5 and my webapp-myNiceWebApp is in Tomcat/webapps/myNiceWebApp I have a class that I have the following code in: Logger logger = Logger.getLogger(Helper.class); SimpleLayout layout = new SimpleLayout();

Re: Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Ben Souther
Log4j looks on your class path for a properties file log4j.properties. If you put the file in WEB-INF/classes it will find it. Here's a real simple example: log4j.rootCategory=DEBUG, dest1 log4j.appender.dest1=org.apache.log4j.RollingFileAppender

Re: Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Mufaddal Khumri
I just did that. I have a log4j.properties file with the following: # initialise root logger with level DEBUG and call it A1 log4j.rootLogger=DEBUG, A1 # set the appender to be FileAppender log4j.appender.A1=org.apache.log4j.FileAppender # set set that layout to be SimpleLayout

Re: Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Mufaddal Khumri
I just did that. I have a WEB-INF/classes/log4j.properties file with the following: # initialise root logger with level DEBUG and call it A1 log4j.rootLogger=DEBUG, A1 # set the appender to be FileAppender log4j.appender.A1=org.apache.log4j.FileAppender # set set that layout to be SimpleLayout

Re: Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Ben Souther
Try pulling out the: PropertyConfigurator.configure(log4j.properties) line. You shouldn't need it. Just let log4j find it in your classes directory. On Thu, 2004-10-28 at 20:14, Mufaddal Khumri wrote: I just did that. I have a WEB-INF/classes/log4j.properties file with the following: #

Re: Log4j with Tomcat .. (3 questions)

2004-10-28 Thread Ben Souther
Ah, sorry. I didn't look closely enough at your code. The first example on this page shows how to read a properties file using getResourceAsStream(). Use that to get the properties file for the Configurator. http://nagoya.apache.org/wiki/apachewiki.cgi?Tomcat/Howto On Thu, 2004-10-28