I am doing the following in log4j.properties
log4j.rootLogger=DEBUG, A
log4j.logger.com.datacorrection.updateWkfHistory=DEBUG
log4j.appender.A=org.apache.log4j.FileAppender
log4j.appender.A.File=c:\\TEMP\\a.log
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - %m%n
When I execute my
Java program for the first time the logs are added to a.log. But when I execute the program again, the logs are appended to the existing logs only. This makes the log file very big and difficult to understand. Is it possible to create a new log file everytime code is executed.
Secondly, Can I print the same logs to console as well which are being written to log file.
Thank you