log4j properties configuration

log4j.properties:

# Log levels
log4j.rootLogger=TRACE,CONSOLE,R
# Appender Configuration
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
# Pattern to output the caller's file name and line number
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
# Rolling File Appender
log4j.appender.R=org.apache.log4j.RollingFileAppender
#my log data
log4j.appender.R.File=rolling-log.log
# Path and file name to store the log file
log4j.appender.R.File=logs/testlog.log
#Max log file size.On reaching max size new file will be created automaticlly
log4j.appender.R.MaxFileSize=100KB
# Number of backup files
log4j.appender.R.MaxBackupIndex=2
# Layout for Rolling File Appender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d - %c - %p - %m%n

No comments:

Post a Comment