Logging to a File
Properties to send logging messages to a file.
To redirect the logging messages to a file instead of sending them to stdout, complete the following steps:
- Procedure
- Edit the log4j.properties file in a text editor.
- Add the following properties:
log4j.rootLogger = DEBUG, Console, file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=test.log log4j.appender.file.MaxFileSize=10MB log4j.appender.file.MaxBackupIndex=2 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%m%n
- Save the changes to the file.