两个log4j.properties文件

 

T同事给我发的一个。

# An example log4j configuration file that outputs both to System.out
# and a file named 'test'.  

# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.

# WARNING: Location information can be useful but is very costly in
# terms of computation.

# The root logger uses the appender called A1. 

# The root logger uses the appenders called A1 and A2. Since no level
# is specified, note the empty string between the comma (",") and the
# equals sign ("="), the level of the root logger remains
# untouched. Log4j always initializes the level for the root logger to
# DEBUG. The root logger is the only logger that has a default
# level. Bu default, all other loggers do not have an assigned level,
# such that they inherit their level instead.

log4j.rootLogger=info, console, Veritas

# A1 is set to be ConsoleAppender sending its output to System.out
log4j.appender.console=org.apache.log4j.ConsoleAppender


# A1 uses PatternLayout.
#log4j.appender.console.layout=org.apache.log4j.SimpleLayout
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n


# Appender Veritas writes to the file "test".
log4j.appender.Veritas=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Veritas.File=D:Program FilesSS.log
#log4j.appender.Veritas.File=/opt/shared/onege/log/water/app/qmi/Veritas.log
log4j.appender.Veritas.DatePattern='.'yyyy-MM-dd
# Truncate 'test' if it aleady exists.
log4j.appender.Veritas.Append=true

# Appender Veritas uses the PatternLayout.
log4j.appender.Veritas.layout=org.apache.log4j.PatternLayout
log4j.appender.Veritas.layout.ConversionPattern=[%d{ISO8601}][%t][%-5p] %c - %m%n
#log4j.appender.Veritas.MaxFileSize=15000KB
# Keep five backup file 
#log4j.appender.Veritas.MaxBackupIndex=5
#%-5r %-5p [%t] %c{2} - %m%n

 

 Spring 入门与精通里面的一个,这个配置非常有利于学习Spring,特别是在做Spring与其它东西的整合,至于为什么......用了就知道了。

log4j.rootLogger=DEBUG,stdout,R
#定义log4j的显示方式
log4j.appender.A1=org.apache.log4j.RollingFileAppender
#指定日志输入文件的名称
log4j.apaender.A1.File=org.log
#指定日志输入文件的大小
log4j.apaender.A1.MaxFileSize=500KB
log4j.apaender.A1.MaxBackupIndex=50
log4j.apaender.A1.Append=true
log4j.apaender.A1.layout=org.apache.log4j.PatternLayout
log4j.apaender.A1.layout.ConversionPattern=%d{ISO8601}-[%p][%C{1}]-%m%n
log4j.apaender.A2=org.apache.log4j.RollingFileAppender
log4j.apaender.A2.File=eyeqq.log
log4j.apaender.A2.MaxFileSize=500KB
log4j.apaender.A2.MaxBackupIndex=50
log4j.apaender.A2.Append=true
log4j.apaender.A2.layout=org.apache.log4j.PatternLayout
log4j.apaender.A2.layout.ConversionPattern=%d{ISO8601}-[%p][%C{1}]-%m%n

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#Pattern to output the caller's file name and line umber.
log4j.appender.stdout.layout.ConversionPattern=[%-5p]%d{yyyy-MM-dd HH:mm:ss}%c-%m%n

log4j.appender.R=org.apache.log4j.RollingFleAppender
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
#this log file will be stored in web server's /bin directory,modify to your path which want 

to store.
log4j.appender.R.File=gf.log
log4j.appender.R.datePattern='.'yyyy-MM-dd-HH-mm
log4j.appender.R.append=true
##keep one backup file
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%-5p]%d{yyyy-MM-dd HH:mm:ss}%c-%m%n
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值