码迷,mamicode.com
首页 > 其他好文 > 详细

Log

时间:2018-10-15 16:20:25      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:div   out   pre   1.2   jar包   logger   OLE   img   std   

jar包:

    org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar
org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar
            log4j\log4j\1.2.17\log4j-1.2.17.jar

配置:

技术分享图片

/test
/test/src/main/java
/test/src/main/java/test
/test/src/main/java/log4j.properties
/test/src/main/resources
/test/src/main/resources/git_add
/test/src/main/resources/log4j.properties

log4j.rootLogger=info, stdout
#log4j.rootLogger=info, logfile

### console \u65E5\u5FD7 ###
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 %p [%c %L] - %m%n

log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.File=tmp/aidfs.log
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern= %d %p [%c %L] - %m%n

格式化输出:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LineSeparator {
    private static Logger logger = LoggerFactory.getLogger(LineSeparator.class);
    public static void main(String[] args) {
        logger.info("{}, {}, {}", true, 1, "lin");
    }
}

 

Log

标签:div   out   pre   1.2   jar包   logger   OLE   img   std   

原文地址:https://www.cnblogs.com/wenlin-gk/p/9791237.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!