在Spring中配置使用commons-logging的simplelog来输出日志

烦透了log4j,最新版的包结构变动也不做下兼容,在spring项目中用会爆找不到class,maven仓中的老版又依赖了一大堆Java1.4的东西,实在是不爽,于是果断抛弃,改用commons-logging的simplelog来输出日志。

要在spring中使用simplelog输出日志,需要在classpath中放入两个properties:commons-logging.properties和simplelog.properties

commons-logging.properties:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

simplelog.properties:

#Set to true if you want the Log instance name to be included in output messages. Defaults to false.
org.apache.commons.logging.simplelog.showlogname=true

#Set to true if you want the last component of the name to be included in output messages. Defaults to true.
#org.apache.commons.logging.simplelog.showShortLogname=false

#Set to true if you want the current date and time to be included in output messages. Default is false.
org.apache.commons.logging.simplelog.showdatetime=true

#The date and time format to be used in the output messages. The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. If the format is not specified or is invalid, the default format is used. The default format is yyyy/MM/dd HH:mm:ss:SSS zzz.
#org.apache.commons.logging.simplelog.dateTimeFormat=yyyy/MM/dd HH:mm:ss:SSS zzz

#Default logging detail level for all instances of SimpleLog. Must be one of: trace debug info warn error fatal If not specified, defaults to info.
#org.apache.commons.logging.simplelog.defaultlog=debug

## Configure logging levels
org.apache.commons.logging.simplelog.log.org.springframework.jdbc=trace
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值