log4j.properties
Posted 看你妹儿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了log4j.properties相关的知识,希望对你有一定的参考价值。
## rootLogger\u662F\u6240\u6709\u65E5\u5FD7\u7684\u6839\u65E5\u5FD7,\u4FEE\u6539\u8BE5\u65E5\u5FD7\u5C5E\u6027\u5C06\u5BF9\u6240\u6709\u65E5\u5FD7\u8D77\u4F5C\u7528
## \u4E0B\u9762\u7684\u5C5E\u6027\u914D\u7F6E\u4E2D,\u6240\u6709\u65E5\u5FD7\u7684\u8F93\u51FA\u7EA7\u522B\u662Finfo,\u8F93\u51FA\u6E90\u662Fconsole
#log4j.rootLogger=info,console
## \u5B9A\u4E49\u8F93\u51FA\u6E90\u7684\u8F93\u5165\u4F4D\u7F6E\u662F\u63A7\u5236\u53F0
#log4j.appender.console=org.apache.log4j.ConsoleAppender
## \u5B9A\u4E49\u8F93\u51FA\u65E5\u5FD7\u7684\u5E03\u5C40\u91C7\u7528\u7684\u7C7B
#log4j.appender.console.layout=org.apache.log4j.PatternLayout
## \u5B9A\u4E49\u65E5\u5FD7\u8F93\u51FA\u5E03\u5C40
#log4j.appender.console.layout.ConversionPattern=%d %p [%c] - %m%n\u00A0
### set log levels ###
log4j.rootLogger = info , stdout , D , E
### \u8F93\u51FA\u5230\u63A7\u5236\u53F0 ###
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}\:%L - %m%n
### \u8F93\u51FA\u5230\u65E5\u5FD7\u6587\u4EF6 ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File = c\:/log/log.log
log4j.appender.D.Append = true
log4j.appender.D.Threshold = INFO
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH\:mm\:ss} [ %t\:%r ] - [ %p ] %m%n
### \u4FDD\u5B58\u5F02\u5E38\u4FE1\u606F\u5230\u5355\u72EC\u6587\u4EF6 ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = c:/log/error.log
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH\:mm\:ss} [ %l\:%c\:%t\:%r ] - [ %p ] %m%n
以上是关于log4j.properties的主要内容,如果未能解决你的问题,请参考以下文章