Change ConsoleAppender to FileAppender. One appender file that I find useful is org.apache.log4j.RollingFileAppender . You will need to add the fileName property and you might also want to set maxFileSize as well. Here is an example (put them in the log4j.properties file):
log4j.appender.NotConsole=org.apache.log4j.RollingFileAppender log4j.appender.NotConsole.fileName=/some/path/to/a/fileName.log log4j.appender.NotConsole.maxFileSize=20MB
There are other applications. DailyRollingFileAppender performs time-based taxiing. FileAppender does not work. If you are using RollingFileAppender, you will need to make an assumption about a good value for maxFileSize, and then specify the size in the future if this causes problems.
DwB Dec 17 '10 at 21:12 2010-12-17 21:12
source share