log4j配置项

log4j 配置文件
log4j.rootLogger=INFO,console,dailyFile
# 控制台配置项
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=INFO
log4j.appender.console.ImmediateFlush=true
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) –> %l: %m %x %n
# 输出到文件配置项
log4j.appender.dailyFile=org.apache.log4j.FileAppender
log4j.appender.dailyFile.File=C:/logs/log
log4j.appender.dailyFile.Append=true
log4j.appender.dailyFile.layout=org.apache.log4j.PatternLayout
log4j.appender.dailyFile.layout.ConversionPattern=%-d{yyyy-MM-dd HH\:mm\:ss} ->%m %n
log4j.appender.dailyFile.Threshold=ERROR
log4j.appender.dailyFile.DatePattern=’.’yyyy-MM-dd
log4j.appender.dailyFile.encoding=UTF-8
# 定义编码格式
log4j.appender.file.encoding=UTF-8

log4j.logger.com=DEBUG
log4j.logger.ch=DEBUG
log4j.logger.org=DEBUG

log4j.rootLogger=DEBUG,console,dailyFile

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=INFO
log4j.appender.console.ImmediateFlush=true
log4j.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) --> %l: %m %x %n

log4j.appender.dailyFile=org.apache.log4j.FileAppender
log4j.appender.dailyFile.File=hlyCrmSyncLog.log
log4j.appender.dailyFile.Append=false
log4j.appender.dailyFile.layout=org.apache.log4j.PatternLayout  
log4j.appender.dailyFile.layout.ConversionPattern=%-d{yyyy-MM-dd HH\:mm\:ss} ->%m %n
log4j.appender.dailyFile.Threshold=INFO
log4j.appender.dailyFile.DatePattern='.'yyyy-MM-dd
log4j.appender.dailyFile.encoding=UTF-8


log4j.appender.file.encoding=UTF-8

log4j.logger.com=DEBUG
log4j.logger.ch=DEBUG
log4j.logger.org=DEBUG

  

    原文作者:菜鸡开发阿飞
    原文地址: https://www.cnblogs.com/zyfBlogShare/p/11858423.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞