You need to put the properties file in the same classloader (or higher) as log4j.jar.  So, if you put log4j.jar in shared/lib, then you need to put the properties file at that level as well.  Standard Java classloading does not allow a parent loader to see child loaders.  If you still want log4j.properties to be in WEB-INF/classes, then move log4j.jar to WEB-INF/lib.

Jake

On Tue, 1 Jul 2008 15:05:38 -0400
 Rashmi <[EMAIL PROTECTED]> wrote:
Hello,

I referred to the Log4J Manual (1.2.9) and set up the log4j.properties
file under the project's C:/dev/projects/projecta/WEB-INF/classes
folder.

The log4j.properties file has:

dir=C:/dev/projects/projecta/logs
file=projecta.log
target=${dir}/${file}
#log4j.debug=true
log4j.rootLogger=DEBUG, DAILYROLLING
log4j.appender.DAILYROLLING=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAILYROLLING.File=${target}
log4j.appender.DAILYROLLING.DatePattern=.yyyy-MM-dd
log4j.appender.DAILYROLLING.layout=org.apache.log4j.PatternLayout
log4j.appender.DAILYROLLING.layout.ConversionPattern=%p %t %c - %m%n
log4j.threshold=DEBUG

The log4j-1.2.15.jar is placed under :
C:\dev\apache-tomcat-6.0.14\shared\lib\ so that it is visible across
all projects

The logging was working the first time when I set it up, but I made a
series of changes that are hard to trace back and now I get
No appenders could be found for logger (... class name) - Please
intialize the log4j system properly

when I invoke
public static Logger logger = Logger.getLogger(AClass.class);
logger.debug("a message");

Please let me know if there are any errors in the above
log4j.properties file or if I have misconfigured Log4J

-Regards
Rashmi

---------------------------------------------------------------------
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]

Reply via email to