February 2005
Intermediate to advanced
528 pages
12h 53m
English
You need to set the severity level and details of the log messages generated by internal Struts components.
Configure Struts logging to use Log4J as its logging implementation:
Download the Log4J jar file from http://jakarta.apache.org/log4j.
Copy the jar file to your application's WEB-INF/lib folder.
Set the log level and log destination (referred to as an
appender) for all Struts packages
(org.apache.struts), as shown in Example 13-1 (log4j.properties). Place
this file in your application's
WEB-INF/classes folder.
Example 13-1. Configuring Log4J for Struts packages
# The output information consists of relative time, log level, thread # name, logger name, nested diagnostic context and the message in that # order. # For the general syntax of property based configuration files see the # documentation of org.apache.log4j.PropertyConfigurator. log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts=DEBUG,Console,File log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n # File is set to be a FileAppender which outputs to struts-debug.log log4j.appender.File=org.apache.log4j.FileAppender log4j.appender.File.file=struts-log.log # File uses PatternLayout. log4j.appender.File.layout=org.apache.log4j.PatternLayout # The conversion pattern uses format specifiers. You might want to # change the pattern an watch ...