Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#
# Configures Log4j as the Tomcat system logger
#

#
# Configure the logger to output info level messages into a rolling log file.
#
log4j.rootLogger=INFO, R

#
# Configuration for a rolling log file
#
log4j.appender.R=org.apache.log4j.RollingFileAppender

#
# Edit the next line to point to your logs directory.
# The last part of the name is the log file name.
#
log4j.appender.R.File=${catalina.base}/logs/APPLICATION_OUTPUT_FILE.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.MaxFileSize=5036KB
log4j.appender.R.MaxBackupIndex=4

#
# Print the date in ISO 8601 format
#
log4j.appender.R.layout.ConversionPattern=%d %-5p - %m%n

The above configuration creates a rolling output file. Once the file reaches 0.5 Mb in size it is renamed by adding an index to its end and a new log file is created. A maximum of 4 log files is kept.

For more information on how to configure log4j please refer to http://logging.apache.org/log4j/docs/.

If you now redeploy your application all the output from your application should be logged in the file you chose.

...