Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configure log4j properties: not append but create a new file

Status
Not open for further replies.

kknight2046

Programmer
Jul 6, 2006
17
US
I have a question about how to configure the log4j properties, so each time the application starts, the log file will be cleaned up first, instead of logs being appended to the existing log file content.

My configures is like below:

log4j.appender.appResults_Appender=org.apache.log4j.FileAppender
log4j.appender.appResults_Appender.File=appResults.log
log4j.appender.appResults_Appender.Append=false
log4j.appender.appResults_Appender.Threshold=DEBUG
log4j.appender.appResults_Appender.layout=org.apache.log4j.PatternLayout
log4j.appender.appResults_Appender.layout.ConversionPattern= %m%n

When I set log4j.appender.appResults_Appender.Append=false, the log file is cleaned up when my program starts, but the program could not add logs to the log file any more.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top