log4j configuration

log4j.rootLogger=INFO, D

#MAIL               ----- PASS TEST-----
#--------------------------------------------------------------#
log4j.appender.mail=org.apache.log4j.net.SMTPAppender
log4j.appender.mail.Threshold=INFO
log4j.appender.mail.BufferSize=10
log4j.appender.mail.From=*******@qq.com
log4j.appender.mail.SMTPHost=smtp.qq.com
log4j.appender.mail.SMTPUsername=*******
log4j.appender.mail.SMTPPassword=*******
log4j.appender.mail.SMTPDebug=false
log4j.appender.mail.Subject=Log4j Error Message Sent By Eric
log4j.appender.mail.To=*******@qq.com,*******@qq.com
log4j.appender.mail.Bcc=*******@qq.com
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
log4j.appender.mail.layout.ConversionPattern=%d - %c - %-4r [%t] %-5p %c %x - %m%n
#--------------------------------------------------------------#

#Rolling FILE        ----- PASS TEST-----
#--------------------------------------------------------------#
log4j.appender.A=org.apache.log4j.RollingFileAppender
log4j.appender.A.Threshold=INFO
log4j.appender.A.File=e\:/logs/log4j.log
log4j.appender.A.MaxFileSize=1KB
log4j.appender.A.MaxBackupIndex=10
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%d %-5p %c  - %m%n
#--------------------------------------------------------------#

#Console			----- PASS TEST-----
#--------------------------------------------------------------#
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 
log4j.appender.CONSOLE.Threshold=DEBUG 
log4j.appender.CONSOLE.Target=System.out 
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} - %c -%-4r [%t] %-5p %c - %m%n
#--------------------------------------------------------------# 

#Html				----- PASS TEST-----
#--------------------------------------------------------------# 
log4j.appender.B=org.apache.log4j.FileAppender
log4j.appender.B.File=E:/logs/log4j.html
log4j.appender.B.layout=org.apache.log4j.HTMLLayout
log4j.appender.B.layout.LocationInfo=true
#--------------------------------------------------------------# 

#DataBase			----- PASS TEST-----
#--------------------------------------------------------------# 
log4j.appender.C=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.Driver=oracle.jdbc.driver.OracleDriver
log4j.appender.C.URL=jdbc:oracle:thin:@localhost:1521:ora
log4j.appender.C.User=eric
log4j.appender.C.Password=eric
log4j.appender.C.Sql=insert into eric_log_tbl(log_time, log_level, log_class, log_msg) values ('%d', '%p', '%t', '%m')
#--------------------------------------------------------------#

#xml				----- PASS TEST-----
#--------------------------------------------------------------#
log4j.appender.D=org.apache.log4j.FileAppender
log4j.appender.D.File=E:/logs/log4j.xml
log4j.appender.D.layout=org.apache.log4j.xml.XMLLayout
log4j.appender.D.layout.LocationInfo=true
#--------------------------------------------------------------#

你可能感兴趣的:(log4j)