I need to rethink my requirements. Redirecting Tomcat’s output to a file is a workaround to something I’m having trouble figuring out… Maybe this isn’t the best forum to ask it, but since I started, I’ll post it here…
The best option is to use a Logging package, such as Log4j, but I’m having difficulty getting it to work.
I’ve got a basic log4j.properties file specified:
# Set root category priority to DEBUG and appenders to Console and ConsoleLog
log4j.rootCategory=DEBUG, ConsoleLog
# console log
log4j.appender.ConsoleLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ConsoleLog.DatePattern=’.’yyyy-MM-dd
log4j.appender.ConsoleLog.File=thelog.log
log4j.appender.ConsoleLog.layout=org.apache.log4j.PatternLayout
log4j.appender.ConsoleLog.layout.ConversionPattern=%d %-5p %c{1}.%M – %m%n
At the top of my servlet, I have:
private static Logger logger = Logger.getLogger(MyServlet.class);
When Tomcat starts up, It give the message:
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.
All logger messages display on the console… The file is never created.
Again, I know that doesn’t belong on this forum, but maybe someone here can point me in the right direction 🙂