I am new to this log4j and managed to setup on eclipse and get it running. I understand the chain of priority in the levels and right now this is my properties file config:
log4j.rootLogger = DEBUG, rollingFile, console
log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.Threshold=INFO
log4j.appender.rollingFile.File=logs/logFile.log
log4j.appender.rollingFile.MaxFileSize=1MB
log4j.appender.rollingFile.MaxBackupIndex=5
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
log4j.appender.rollingFile.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c: %m%n
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p - %m%n
I have 2 questions for this log4j
1) Is it possible for the log4j to clear my log file each time I launch the application? I am not sure how to do this.
2) Well from the config I setup my console to print debug but what i really wanted it to print is pure debug msg instead of INFO message as well. Is there anyway to control this? Like only print debug and errors if the threshold is set to debug?