# Setting up the different loggers.
log4j.rootLogger=,MONITOR, LOGFILE
Then specify the monitor logger:
# Appender setup A1 = MONITOR
log4j.appender.MONITOR=org.apache.log4j.ConsoleAppender
log4j.appender.MONITOR.Threshold=INFO
And the FileLogger:
# Appender setup A2 = LOGFILE
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.Threshold=DEBUG
log4j.appender.LOGFILE.MaxFileSize=10MB
log4j.appender.LOGFILE.File=/usr/home/props/logs/MonFilLogger.log
Specify for both the pattern:
# MONITOR Uses Pattern Layout
log4j.appender.MONITOR.layout=org.apache.log4j.PatternLayout
log4j.appender.MONITOR.layout.ConversionPattern=%m%n
# LOGFILE uses Pattern Layout
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.additivity.LOGFILE=true
This works for me. Perfect.
No comments:
Post a Comment