夏末秋初 发表于 2015-11-13 14:10:53

org.apache.commons.logging SimpleLog

  1.2个配置文件搞定
  src 下:

commons-logging.properties

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

simplelog.properties

    org.apache.commons.logging.simplelog.defaultlog=trace
org.apache.commons.logging.simplelog.log.XXXXXX=debug
org.apache.commons.logging.simplelog.showlogname=true   
org.apache.commons.logging.simplelog.showShortLogname=true   
org.apache.commons.logging.simplelog.showdatetime=true   
org.apache.commons.logging.simplelog.dateTimeFormat=yyyy-MM-dd hh:mm:ss



其中最主要的两个设置为:org.apache.commons.logging.simplelog.defaultlog和org.apache.commons.logging.simplelog.log.XXXXXX(此处的XXXXXX根据实际情况填写),

这两个设置项值都可以是trace、debug、info、warn、error、fatal中的一个;

org.apache.commons.logging.simplelog.defaultlog设置所有log类的日志级别,而org.apache.commons.logging.simplelog.log.XXXXXX则针对具体实例中的log类设置日志级别,

若实例中的日志级别没有设置,则默认按defaultlog的设置执行;若以上两项都没有设置的话,则会默认是info日志级别。



2.SimpleLog类把日志输出到System.err中,无需你自己配置

版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: org.apache.commons.logging SimpleLog