I am working on a Java SOAP based webservice application where I am writing stdout to a text file as log for our reference. That file is growing enormously, so I need to check f
In log4j.xml you can try the following:
The value tells log4j.xml to only keep 10 rotated log files around.
Alternatively, if you are using a properties file (instead of the xml)
log4j.appender.File=org.apache.log4j.RollingFileAppender
log4j.appender.File.File=applog.log
log4j.appender.File.Append=true
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
log4j.appender.[appenderName].MaxBackupIndex = 10