Hi,
Im trying to use log4j with tomcat. Im developing in eclipse. It seems to be ignoring my properties file and going all messages get logged to the console. This is my properties file:

log4j.rootLogger=DEBUG, A4

log4j.appender.A4=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A4.File=c:/ccLogs/ccLog.log
# Roll the log file at a certain time
log4j.appender.A4.DatePattern='.'yyyy-MM-dd-HH-mm
# Append to the end of the file or overwrites the file at start.
log4j.appender.A4.Append=true
log4j.appender.A4.layout=org.apache.log4j.PatternLayout
log4j.appender.A4.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n

The class that calls it is in WEB-INF/src/utilities
Ive tried placing the properties file in WEB-INF/src/utilities and WEB-INF/src but it can never find it. Ive tried removing it altogether and it makes no difference (leading me to believe it is never loaded properly)

In my class I instansiate my logging class like this:

static Logger log = Logger.getLogger("myclassname");

Tomcat has its own log4J configuration that overrides your own.
Append your own config to that one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.