Tag Archives: logging

log4j: routing logs to multiple files based on log levels


Sample log4j.properties to route logs of same app to multiple files – one ideally less verbose that can be shared with customer/to know status quickly, the other one verbose/exhaustive. Logging framework: Apache log4j 1.12.16 log4j.rootLogger=DEBUG, logfile, detaillogfile # less verbose log with a threshold of INFO log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender log4j.appender.logfile.Threshold=INFO log4j.appender.logfile.DatePattern=’.’yyyy-MM-dd’.log’ log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=[%d] %m log4j.appender.logfile.File=logs/mylogfile.log # no […]