log4j禁止日志输出

log4j.rootLogger=info,A1,A2
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.target=System.out
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r %-5p [%t] %3c %3x %m%n
#log4j.appender.A1.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %m %n

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.File=D:/epayTest/log/online.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
##log4j.appender.A2.layout.ConversionPattern=%-4r %-5p [%t] %3c %3x [content] %m%n %d %-5p [%X{localId}] %m%n
log4j.appender.A2.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %3c [%X{localId}] %m%n

#直接禁止输出

log4j.logger.com.netpay.pp.time.TimerServerWithMerchantCache=OFF
#禁用日志输出
log4j.logger.com.netpay.pp.time.TimerServerWithMerchantCache=info,Cache  
log4j.logger.com.netpay.pp.online.main.ServerStart=info,Cache  
log4j.additivity.com.netpay.pp.time.TimerServerWithMerchantCache=false
log4j.logger.com.netpay.pp.merchant=debug,Cache  
log4j.appender.Cache=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Cache.File=D:/epayTest/log/Cache.log
log4j.appender.Cache.layout=org.apache.log4j.PatternLayout
log4j.appender.Cache.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %m %n


log4j.logger.xmlLog=info,xmlLog
log4j.appender.xmlLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.xmlLog.File=D:/epayTest/log/onlineTime.log
log4j.appender.xmlLog.layout=org.apache.log4j.PatternLayout
log4j.appender.xmlLog.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %m %n

 

#多个定义输出到一个文件,只能使用一个appender输出,否则3个配置3个各自的appender则会出现其中一个生效(先触发),因为触发的获取到日志输出的文件锁,其余不起作用

log4j.additivity.payLog=false   #禁止打印到其他日志中
log4j.additivity.refundLog=false
log4j.additivity.signLog=false
log4j.logger.signLog=info,xml
log4j.logger.payLog=info,xml
log4j.logger.refundLog=info,xml
log4j.appender.xml=org.apache.log4j.DailyRollingFileAppender
log4j.appender.xml.File=/tmp/onlineTime.log
log4j.appender.xml.layout=org.apache.log4j.PatternLayout
log4j.appender.xml.layout.ConversionPattern=[%-5p] %d{HH:mm:ss.SSS} %c %m %n

转载于:https://www.cnblogs.com/atwanli/articles/4885367.html

你可能感兴趣的:(log4j禁止日志输出)