Due to the activation of the Timer refresh program, a large number of logs are made in the Catalina.out configuration file, which makes the program difficult to debug. The log cannot be viewed properly. Therefore, the customer requests that the performance traffic configuration log be migrated out of the Catalina.out directory. After modifying the log4j configuration file, the log output is found in the sub-file, but the performance traffic log output is still available in the Catalina.out file. The original configuration method is as follows:
Log4j.logger.com.test.cao.snmpgather = INFO, Snmpgather
log4j.appender.snmpgather= Org.apache.log4j.DailyRollingFileAppender
log4j.appender.snmpgather.file=${catalina.home}/logs/performance /snmpgather_
log4j.appender.snmpgather.datepattern= yyyy-mm-dd '. Log '
log4j.appender.snmpgather.layout= Org.apache.log4j.PatternLayout
log4j.appender.snmpgather.layout.conversionpattern=%-d{yyyy-mm-dd HH:mm:ss, SSS} [%p] [%c.%m:%l]%m%n
Later found the following method, you can remove the log from the Catalina.out Workbench log file, log4j.additivity the current configuration file as follows:
Log4j.logger.com.test.cao.snmpgather = INFO, Snmpgather
log4j.appender.snmpgather= Org.apache.log4j.DailyRollingFileAppender
log4j.appender.snmpgather.file=${catalina.home}/logs/performance /snmpgather_
log4j.appender.snmpgather.datepattern= yyyy-mm-dd '. Log '
log4j.appender.snmpgather.layout= Org.apache.log4j.PatternLayout
log4j.appender.snmpgather.layout.conversionpattern=%-d{yyyy-mm-dd HH:mm:ss, SSS} [%p] [%c.%m:%l]%m%n
Log4j.additivity.com.linkage.module.liposs.system.cao.snmpgather = False
Here is log4j.additivity explanation: Log4j.additivity is the flag bit of whether the child logger inherits the output source (Appender) of the parent logger.
Specifically, by default, logger inherits the Appender of the parent logger, which means that the logger is output in the logger of the parent appender.
If Additivity is set to false, the child logger will only output in its own appender, not in the appender of the parent logger. Because the parent log is:
log4j.rootcategory=, A1, R
log4j.appender.a1=org.apache.log4j.consoleappender
Log4j.appender.a1.threshold=info
log4j.appender.a1.layout=org.apache.log4j.patternlayout
log4j.appender.a1.layout.conversionpattern=%-d{yyyy-mm-dd HH:mm:ss} [%c]-[%p]%m%n
log4j.appender.r.threshold =info
log4j.appender.r.maxfilesize=100kb
log4j.appender.r.maxbackupindex=10
Log4j.appender.r.layout=org.apache.log4j.patternlayout
log4j.appender.r.layout.conversionpattern=%p%t%c-%m %n
So it hits the workbench. Setting Additivity to False relies only on its own configuration.