2013-08-08 2 views
7

log4j2를 처음 사용하려고합니다. 그것을 제외하고는 내 구성에 따라 로깅도 콘솔로 구성 디버그 메시지 같은 것을 출력한다 : 이것이 내가 어떻게이log4j2 구성 디버그 메시지가 나타나지 않도록하십시오.

<?xml version="1.0" encoding="UTF-8" ?> 
<configuration status="DEBUG"> 
    <appenders> 

     <Console name="Console" target="SYSTEM_OUT"> 
      <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %msg%n" /> 
     </Console> 

     <RollingFile name="RollingFileAll" fileName="logs/preprocessor.log" 
      filePattern="logs/preprocessor-%d{yyyy-MM-dd-HH}-%i.log.gz"> 
      <PatternLayout pattern="%d{MM-dd HH:mm:ss.SSS} %-5level %msg%n" /> 
      <Policies> 
       <SizeBasedTriggeringPolicy size="10 MB" /> 
      </Policies> 
     </RollingFile> 

    </appenders> 
    <loggers> 
     <root level="DEBUG"> 
      <appender-ref ref="Console" level="INFO" /> 
      <appender-ref ref="RollingFileAll" /> 
     </root> 
    </loggers> 
</configuration> 

그리고 : 같은

2013-08-07 19:36:50,870 DEBUG Generated plugins in 0.000029274 seconds 
2013-08-07 19:36:50,871 DEBUG Generated plugins in 0.000028703 seconds 
2013-08-07 19:36:50,871 DEBUG Generated plugins in 0.000022613 seconds 
2013-08-07 19:36:50,872 DEBUG Generated plugins in 0.000017492 seconds 
2013-08-07 19:36:50,872 DEBUG Generated plugins in 0.000017009 seconds 
2013-08-07 19:36:50,873 DEBUG Generated plugins in 0.000025645 seconds 
2013-08-07 19:36:50,873 DEBUG Generated plugins in 0.000017140 seconds 
2013-08-07 19:36:50,873 DEBUG Generated plugins in 0.000017438 seconds 
2013-08-07 19:36:50,874 DEBUG Generated plugins in 0.000018848 seconds 
2013-08-07 19:36:50,874 DEBUG Generated plugins in 0.000018203 seconds 
2013-08-07 19:36:50,875 DEBUG Generated plugins in 0.000017775 seconds 
2013-08-07 19:36:50,875 DEBUG Generated plugins in 0.000018104 seconds 
2013-08-07 19:36:50,876 DEBUG Generated plugins in 0.000017015 seconds 
2013-08-07 19:36:50,876 DEBUG Generated plugins in 0.000018079 seconds 
2013-08-07 19:36:50,890 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %msg%n", Configuration(.../conf/preprocessor.log4j2.xml), null, charset="null", suppressExceptions="null") 
2013-08-07 19:36:50,890 DEBUG Generated plugins in 0.000032718 seconds 
2013-08-07 19:36:50,893 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %msg%n), null, target="SYSTEM_OUT", name="Console", follow="null", suppressExceptions="null") 
2013-08-07 19:36:50,894 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{MM-dd HH:mm:ss.SSS} %-5level %msg%n", Configuration(.../conf/preprocessor.log4j2.xml), null, charset="null", suppressExceptions="null") 
2013-08-07 19:36:50,895 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy for element SizeBasedTriggeringPolicy with params(size="10 MB") 
2013-08-07 19:36:50,897 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy for element Policies with params(policies={SizeBasedTriggeringPolicy(size=10485760)}) 
2013-08-07 19:36:50,900 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile with params(fileName="logs/preprocessor.log", filePattern="logs/preprocessor-%d{yyyy-MM-dd-HH}-%i.log.gz", append="null", name="RollingFileAll", bufferedIO="null", immediateFlush="null", Policies(CompositeTriggeringPolicy{SizeBasedTriggeringPolicy(size=10485760)}), null, PatternLayout(%d{MM-dd HH:mm:ss.SSS} %-5level %msg%n), null, suppressExceptions="null", advertise="null", advertiseURI="null", Configuration(..../conf/preprocessor.log4j2.xml)) 
2013-08-07 19:36:50,902 DEBUG Starting RollingFileManager logs/preprocessor.log 
2013-08-07 19:36:50,904 DEBUG Generated plugins in 0.000022500 seconds 
2013-08-07 19:36:50,906 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, RollingFileAll}) 
2013-08-07 19:36:50,906 DEBUG Generated plugins in 0.000019671 seconds 
2013-08-07 19:36:50,908 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="WARN", null) 
2013-08-07 19:36:50,908 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="RollingFileAll", level="null", null) 
2013-08-07 19:36:50,910 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="ERROR", name="eventLogger", includeLocation="null", appender-ref={[email protected], [email protected]}, properties={}, Configuration(.../conf/preprocessor.log4j2.xml), null) 
2013-08-07 19:36:50,912 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="INFO", null) 
2013-08-07 19:36:50,913 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="RollingFileAll", level="null", null) 
2013-08-07 19:36:50,915 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="DEBUG", includeLocation="null", appender-ref={[email protected], [email protected]}, properties={}, Configuration(.../preprocessor.log4j2.xml), null) 
2013-08-07 19:36:50,916 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={eventLogger, root}) 

내 구성 파일 preprocessor.log4j2.xml 보이는 자바 내에서 (내가 자동 구성에 대해 알고)가 log4j2를 구성 : 나는 EventLogger 로거를 추가하고 그 출력을 사용하지 않도록 노력했지만, 그것은 도움이되지 않았다

File file = new File(LOG4J2_CONF_FILE); 
Configurator.initialize("preprocessor", null, file.toURI()); 

. 이 구성 디버그 메시지가 나타나지 않도록하는 방법에 대해 알고 계십니까?

팁을 미리 보내 주셔서 감사합니다.

+0

이 답을 얻는다면 status="DEBUG"을 그냥 제거하십시오. 대답을 – chaosguru

+0

재미있게 선택하십시오. 오랫동안 디버그 메시지를 출력하는 방법을 찾고있었습니다. 거기에 당신은 그것을 가지고 있습니다. – Blub

답변

8

+0

고마워요! 그게 내 문제를 성공적으로 해결했습니다. –

관련 문제