当前位置: 首页 > 工具软件 > j2wap > 使用案例 >

pr 增加配置文件和级别_比较全的log4j.prperties配置文件

卫诚
2023-12-01

1 ### set log levels ###2 log4j.rootLogger=DEBUG,stdout,console,logFile,dailyFile3 log4j.additivity.org.apache=true

4

5 log4j.logger.org=ERROR,A16 #定义log4j的显示方式7 log4j.appender.A1=org.apache.log4j.RollingFileAppender8 #指定日志输入的文件名称9 log4j.appender.A1.File=org.log10 #指定日志输入的文件大小11 log4j.appender.A1.MaxFileSize=500KB12 log4j.appender.A1.MaxBackupIndex=50

13 log4j.appender.A1.Append=true

14 log4j.appender.A1.layout=org.apache.log4j.PatternLayout15 #指定日志输入文件的内容格式16 log4j.appender.A1.layout.ConversionPattern=%d{ISO8601}-[%p][%C{1}]-%m%n17

18 #定义log4j的显示方式内天19 log4j.appender.stdout=org.apache.log4j.ConsoleAppender20 #指定日志输入的文件名称21 log4j.appender.stdout.File=gf.log22 #指定日志输入的文件大小都是23 log4j.appender.stdout.MaxFileSize=500KB24 log4j.appender.stdout.MaxBackupIndex=50

25 log4j.appender.stdout.Append=true

26 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout27 #指定日志输入文件的内容格式28 log4j.appender.stdout.layout.ConversionPattern=[%-5p]%d{yyyy-MM-dd HH:mm:ss}%c-%m%n29

30

31 # 控制台(console)32 log4j.appender.console=org.apache.log4j.ConsoleAppender33 log4j.appender.console.Threshold=DEBUG34 log4j.appender.console.ImmediateFlush=true

35 log4j.appender.console.Target=System.err36 log4j.appender.console.layout=org.apache.log4j.PatternLayout37 log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n38

39 # 日志文件(logFile)40 log4j.appender.logFile=org.apache.log4j.FileAppender41 log4j.appender.logFile.Threshold=DEBUG42 log4j.appender.logFile.ImmediateFlush=true

43 log4j.appender.logFile.Append=true

44 log4j.appender.logFile.File=D:/logs/log.log4j45 log4j.appender.logFile.layout=org.apache.log4j.PatternLayout46 log4j.appender.logFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n47

48 # 回滚文件(rollingFile)49 log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender50 log4j.appender.rollingFile.Threshold=DEBUG51 log4j.appender.rollingFile.ImmediateFlush=true

52 log4j.appender.rollingFile.Append=true

53 log4j.appender.rollingFile.File=D:/logs/log.log4j54 log4j.appender.rollingFile.MaxFileSize=200KB55 log4j.appender.rollingFile.MaxBackupIndex=50

56 log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout57 log4j.appender.rollingFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n58

59 # 定期回滚日志文件(dailyFile)60 log4j.appender.dailyFile=org.apache.log4j.DailyRollingFileAppender61 log4j.appender.dailyFile.Threshold=DEBUG62 log4j.appender.dailyFile.ImmediateFlush=true

63 log4j.appender.dailyFile.Append=true

64 log4j.appender.dailyFile.File=D:/logs/log.log4j65 log4j.appender.dailyFile.DatePattern='.'yyyy-MM-dd66 log4j.appender.dailyFile.layout=org.apache.log4j.PatternLayout67 log4j.appender.dailyFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n68

69 # 应用于socket70 log4j.appender.socket=org.apache.log4j.RollingFileAppender71 log4j.appender.socket.RemoteHost=localhost72 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.PatternLayout76 log4j.appender.socket.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n77 # Log Factor 5Appender78 log4j.appender.LF5_APPENDER=org.apache.log4j.lf5.LF5Appender79 log4j.appender.LF5_APPENDER.MaxNumberOfRecords=2000

80 # 发送日志到指定邮件81 #log4j.appender.mail=org.apache.log4j.net.SMTPAppender82 #log4j.appender.mail.Threshold=FATAL83 #log4j.appender.mail.BufferSize=10

84 #log4j.appender.mail.From =xxx@mail.com85 #log4j.appender.mail.SMTPHost=mail.com86 #log4j.appender.mail.Subject=Log4J Message87 #log4j.appender.mail.To=xxx@mail.com88 #log4j.appender.mail.layout=org.apache.log4j.PatternLayout89 #log4j.appender.mail.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n90 # 应用于数据库91 #log4j.appender.database=org.apache.log4j.jdbc.JDBCAppender92 #log4j.appender.database.URL=jdbc:mysql://localhost:3306/test

93 #log4j.appender.database.driver=com.mysql.jdbc.Driver94 #log4j.appender.database.user=root95 #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.PatternLayout98 #log4j.appender.database.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n99

100 # 自定义Appender101 #log4j.appender.im =net.cybercorlin.util.logger.appender.IMAppender102 #log4j.appender.im.host =mail.cybercorlin.net103 #log4j.appender.im.username =username104 #log4j.appender.im.password =password105 #log4j.appender.im.recipient =corlin@cybercorlin.net106 #log4j.appender.im.layout=org.apache.log4j.PatternLayout107 #log4j.appender.im.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n108

109 #wap是包名(wap.logs); log是输出目的地即/usr/local/zhou/resin/phones110 #log4j.logger.wap=INFO, log111 #每天产生一个日志文件112 #log4j.appender.log=org.apache.log4j.DailyRollingFileAppender113 # log4j.appender.log.File=${wap.root}/logs/logs114 #log4j.appender.log.File=/usr/local/zhou/resin/phones115 #指定年月日的格式为2009-12-24

116 #log4j.appender.log.DatePattern='.'yyyy-MM-dd117 #log4j.appender.log.layout=org.apache.log4j.PatternLayout118 #log4j.appender.log.layout.ConversionPattern=%d|%m%n119

120 #log4j.logger.unicom=INFO, unicom121 #每天产生一个日志文件122 #log4j.appender.unicom=org.apache.log4j.DailyRollingFileAppender123 # log4j.appender.log.File=${wap.root}/logs/logs124 #log4j.appender.unicom.File=/usr/local/zhou/resin/unicom125 #log4j.appender.unicom.DatePattern='.'yyyy-MM-dd126 #log4j.appender.unicom.layout=org.apache.log4j.PatternLayout127 #log4j.appender.unicom.layout.ConversionPattern=%d|%m%n128

129 #log4j.logger.user=INFO, user130 #每天产生一个日志文件131 #log4j.appender.user=org.apache.log4j.DailyRollingFileAppender132 #log4j.appender.user.File=/usr/local/zhou/resin/user133 #log4j.appender.user.DatePattern='.'yyyy-MM-dd134 #log4j.appender.user.layout=org.apache.log4j.PatternLayout135 #log4j.appender.user.layout.ConversionPattern=%d|%m%n

 类似资料: