比较全的log4j.prperties配置文件

  1  ### set log levels ### 
  2 log4j.rootLogger=DEBUG,stdout,console,logFile,dailyFile
  3 log4j.additivity.org.apache=true
  4 
  5 log4j.logger.org=ERROR,A1
  6 #定义log4j的显示方式
  7 log4j.appender.A1=org.apache.log4j.RollingFileAppender
  8 #指定日志输入的文件名称
  9 log4j.appender.A1.File=org.log
 10 #指定日志输入的文件大小
 11 log4j.appender.A1.MaxFileSize=500KB
 12 log4j.appender.A1.MaxBackupIndex=50
 13 log4j.appender.A1.Append=true
 14 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 15 #指定日志输入文件的内容格式
 16 log4j.appender.A1.layout.ConversionPattern=%d{ISO8601}-[%p][%C{1}]-%m%n
 17 
 18 #定义log4j的显示方式内天
 19 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 20 #指定日志输入的文件名称 
 21 log4j.appender.stdout.File=gf.log
 22 #指定日志输入的文件大小都是
 23 log4j.appender.stdout.MaxFileSize=500KB
 24 log4j.appender.stdout.MaxBackupIndex=50
 25 log4j.appender.stdout.Append=true
 26 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 27 #指定日志输入文件的内容格式
 28 log4j.appender.stdout.layout.ConversionPattern=[%-5p]%d{yyyy-MM-dd HH:mm:ss}%c-%m%n
 29 
 30 
 31 # 控制台(console)
 32 log4j.appender.console=org.apache.log4j.ConsoleAppender
 33 log4j.appender.console.Threshold=DEBUG
 34 log4j.appender.console.ImmediateFlush=true
 35 log4j.appender.console.Target=System.err
 36 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 37 log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 38 
 39 # 日志文件(logFile)
 40 log4j.appender.logFile=org.apache.log4j.FileAppender
 41 log4j.appender.logFile.Threshold=DEBUG 
 42 log4j.appender.logFile.ImmediateFlush=true
 43 log4j.appender.logFile.Append=true
 44 log4j.appender.logFile.File=D:/logs/log.log4j
 45 log4j.appender.logFile.layout=org.apache.log4j.PatternLayout
 46 log4j.appender.logFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 47 
 48 # 回滚文件(rollingFile)
 49 log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
 50 log4j.appender.rollingFile.Threshold=DEBUG 
 51 log4j.appender.rollingFile.ImmediateFlush=true
 52 log4j.appender.rollingFile.Append=true
 53 log4j.appender.rollingFile.File=D:/logs/log.log4j
 54 log4j.appender.rollingFile.MaxFileSize=200KB
 55 log4j.appender.rollingFile.MaxBackupIndex=50
 56 log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
 57 log4j.appender.rollingFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 58 
 59 # 定期回滚日志文件(dailyFile)
 60 log4j.appender.dailyFile=org.apache.log4j.DailyRollingFileAppender
 61 log4j.appender.dailyFile.Threshold=DEBUG 
 62 log4j.appender.dailyFile.ImmediateFlush=true
 63 log4j.appender.dailyFile.Append=true
 64 log4j.appender.dailyFile.File=D:/logs/log.log4j
 65 log4j.appender.dailyFile.DatePattern='.'yyyy-MM-dd
 66 log4j.appender.dailyFile.layout=org.apache.log4j.PatternLayout
 67 log4j.appender.dailyFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 68 
 69 # 应用于socket
 70 log4j.appender.socket=org.apache.log4j.RollingFileAppender
 71 log4j.appender.socket.RemoteHost=localhost
 72 log4j.appender.socket.Port=5001
 73 log4j.appender.socket.LocationInfo=true
 74 # Set up for Log Factor 5
 75 log4j.appender.socket.layout=org.apache.log4j.PatternLayout
 76 log4j.appender.socket.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 77 # Log Factor 5 Appender
 78 log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender
 79 log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000
 80 # 发送日志到指定邮件
 81 #log4j.appender.mail=org.apache.log4j.net.SMTPAppender
 82 #log4j.appender.mail.Threshold=FATAL
 83 #log4j.appender.mail.BufferSize=10
 84 #log4j.appender.mail.From = xxx@mail.com
 85 #log4j.appender.mail.SMTPHost=mail.com
 86 #log4j.appender.mail.Subject=Log4J Message
 87 #log4j.appender.mail.To= xxx@mail.com
 88 #log4j.appender.mail.layout=org.apache.log4j.PatternLayout
 89 #log4j.appender.mail.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 90 # 应用于数据库
 91 #log4j.appender.database=org.apache.log4j.jdbc.JDBCAppender
 92 #log4j.appender.database.URL=jdbc:mysql://localhost:3306/test
 93 #log4j.appender.database.driver=com.mysql.jdbc.Driver
 94 #log4j.appender.database.user=root
 95 #log4j.appender.database.password=
 96 #log4j.appender.database.sql=INSERT INTO LOG4J (Message) VALUES('=[%-5p] %d(%r) --> [%t] %l: %m %x %n')
 97 #log4j.appender.database.layout=org.apache.log4j.PatternLayout
 98 #log4j.appender.database.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
 99 
100 # 自定义Appender
101 #log4j.appender.im = net.cybercorlin.util.logger.appender.IMAppender
102 #log4j.appender.im.host = mail.cybercorlin.net
103 #log4j.appender.im.username = username
104 #log4j.appender.im.password = password
105 #log4j.appender.im.recipient = corlin@cybercorlin.net
106 #log4j.appender.im.layout=org.apache.log4j.PatternLayout
107 #log4j.appender.im.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n
108 
109 #wap是包名(wap.logs); log是输出目的地即/usr/local/zhou/resin/phones  
110 #log4j.logger.wap=INFO, log  
111 #每天产生一个日志文件  
112 #log4j.appender.log=org.apache.log4j.DailyRollingFileAppender  
113 # log4j.appender.log.File=${wap.root}/logs/logs  
114 #log4j.appender.log.File=/usr/local/zhou/resin/phones  
115 #指定年月日的格式为2009-12-24  
116 #log4j.appender.log.DatePattern='.'yyyy-MM-dd  
117 #log4j.appender.log.layout=org.apache.log4j.PatternLayout  
118 #log4j.appender.log.layout.ConversionPattern=%d|%m%n  
119 
120 #log4j.logger.unicom=INFO, unicom   
121 #每天产生一个日志文件  
122 #log4j.appender.unicom=org.apache.log4j.DailyRollingFileAppender  
123 # log4j.appender.log.File=${wap.root}/logs/logs  
124 #log4j.appender.unicom.File=/usr/local/zhou/resin/unicom  
125 #log4j.appender.unicom.DatePattern='.'yyyy-MM-dd  
126 #log4j.appender.unicom.layout=org.apache.log4j.PatternLayout  
127 #log4j.appender.unicom.layout.ConversionPattern=%d|%m%n  
128   
129 #log4j.logger.user=INFO, user   
130 #每天产生一个日志文件  
131 #log4j.appender.user=org.apache.log4j.DailyRollingFileAppender  
132 #log4j.appender.user.File=/usr/local/zhou/resin/user  
133 #log4j.appender.user.DatePattern='.'yyyy-MM-dd  
134 #log4j.appender.user.layout=org.apache.log4j.PatternLayout  
135 #log4j.appender.user.layout.ConversionPattern=%d|%m%n 
log4j.properties

 

posted @ 2013-11-29 10:07  willbe努力创新  阅读(565)  评论(0编辑  收藏  举报