This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes need help with first time setup of log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "need help with first time setup of log4j" Watch "need help with first time setup of log4j" New topic
Author

need help with first time setup of log4j

J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 919
    
  13

I have it working on my local server setup, but can't get it working on the Tomcat/Red Hat box. The log file is never created and nothing appears in catalina.out, which if I understand correctly, is where the console appender messages should appear. Please correct me if that's wrong.

The log4j.jar file is in the Tomcat /lib directory and the log4j.properties file is in mywebapp/WEB-INF/classes. Here is the properties file:

# map this appender as the root logger
# set the debugging on for testing the log4j setup
log4j.debug=true

log4j.rootLogger=DEBUG, R, consoleAppender

# console appender
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%-5p %c{2} %x - %m%n

# file appender
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/opt/apache-tomcat-6.0.20/logs/breakingnews.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p %c{2} %x - %m%n

# set the maximum log file size
log4j.appender.R.MaxFileSize=100KB
# archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1

I'm at a loss as to how to troubleshoot this any further. I've restarted the webapp and even restarted Tomcat with no change. There are no errors in catalina.out and no errors from the app when it hits the log.debug statements.

At this point I'm thinking about creating a simple, single page jsp test app that runs in it's own context to try and confirm that log4j is working, but I feel like I'm clutching at straws. Any tips? Am I correct that console appender messages should appear in catalina.out?


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
 
wood burning stoves
 
subject: need help with first time setup of log4j