log4j

log4j.rootCategory=DEBUG, STDOUT, DAILYFILE, HTML, DATABASE
#log4j.rootCategory=DEBUG, STDOUT, DAILYFILE, ROLLINGFILE, HTML

#console
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=[[%d{yyyy MMM dd HH:mm:ss,SSS}] %p [%t] %l ]: %m%n

log4j.logger.com.troy.xmpl.log4j=INFO
log4j.logger.com.troy.xmpl.model=ERROR


#daily file
log4j.appender.DAILYFILE=org.apache.log4j.DailyRollingFileAppender  
log4j.appender.DAILYFILE.File=${log4j.log.DAILYFILE}
log4j.appender.DAILYFILE.layout=org.apache.log4j.PatternLayout  
1log4j.appender.DAILYFILE.layout.ConversionPattern=[[%d{yyyy MMM dd HH:mm:ss,SSS}] %p [%t] %l ]: %m%n


#html !! encoding issue exists
log4j.appender.HTML=org.apache.log4j.FileAppender
log4j.appender.HTML.File=${log4j.log.DAILYFILE.HTML}
log4j.appender.HTML.layout=org.apache.log4j.HTMLLayout
log4j.appender.HTML.layout.Title=${log4j.log.DAILYFILE.HTML.TITLE}
log4j.appender.HTML.layout.LocationInfo=true


#database !! encoding issue exists
log4j.appender.DATABASE=org.apache.log4j.jdbc.JDBCAppender 
log4j.appender.DATABASE.URL=${XMPL_DATABASE_URL}
log4j.appender.DATABASE.driver=${XMPL_DATABASE_DRIVER}
log4j.appender.DATABASE.user=${XMPL_DATABASE_USERNAME}
log4j.appender.DATABASE.password=${XMPL_DATABASE_PASSWORD}
log4j.appender.DATABASE.sql = INSERT INTO xmpl.secondary_xmpl_log_tbl (logDate,logTime,logThread,logLevel,logClass,logLogger,logMessage) values ('%d{yyyy-MM-dd}','%d{HH:mm:ss}','%t', '%p', '%c', '%l', '%m') 
log4j.appender.DATABASE.layout=org.apache.log4j.PatternLayout
log4j.appender.DATABASE.layout.ConversionPattern = %d{yyyy MM dd HH:mm:ss,SSS} %-5p %t %c %m

你可能感兴趣的:(log4j)