I have the below configured for log4j which outputs a csv log file. Every time my program executes I wish to start this log file a fresh by overwriting not appending to the log file. I thought I could achieve this by using the append=false
. I know that I have correctly set up log4j as other logs are outputting fine but these are daily rolling logs that are appending which is the desire affect.
Can anyone tell me why the append=false
doesn't seem to work. Is there another setting I've missed?
Here's my config code:
#Image output
log4j.logger.fetch.FetchDirectHolidays=debug, S
log4j.appender.S=org.apache.log4j.FileAppender
log4j.appender.S.File=xml\\logs\\FetchDirectHolidays.csv
log4j.appender.S.append=false
# Keep one backup file
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern= %p , %m%n
What is wrong with my configuration?
I forgot to state that my application is scheduled and I have just read that the Append=false only clears the log file if the whole application is shutdown and restarted. This does not help as I need to clear this log file each time the internal processes executes.