# Root logger option
log4j.rootLogger= DEBUG,errorLogger,stdout,
# Direct log messages to a log file
log4j.appender.errorLogger=org.apache.log4j.RollingFileAppender
log4j.appender.errorLogger.Threshold = ERROR
log4j.appender.errorLogger.File=.\\Log\\logging.log
log4j.appender.errorLogger.MaxFileSize=1MB
log4j.appender.errorLogger.MaxBackupIndex=1
log4j.appender.errorLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.errorLogger.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
The above configuration will write only error log to file system and all the other log in console.
log4j.appender.errorLogger.Threshold = ERROR does the trick.
No comments:
Post a Comment