Próbuję użyć log4j2 po raz pierwszy. Jest zalogowaniu według mojej konfiguracji oprócz tego, że jest coś takiego jak też wyprowadzanie komunikatów debugowania konfiguracja pocieszyć:Unikaj komunikatów debugowania konfiguracji log4j2, aby pojawić się
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})
Mój plik konfiguracyjny preprocessor.log4j2.xml wygląda następująco:
<?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>
I to jest jak ja skonfigurować (wiem o AUTOCONFIGURE) z log4j2 od wewnątrz Java:
File file = new File(LOG4J2_CONF_FILE);
Configurator.initialize("preprocessor", null, file.toURI());
próbowałem dodanie EventLogger rejestratora i wyłączanie jego wyjście, ale to nie pomogło. Czy masz pomysł, jak uniknąć wyświetlania komunikatów debugowania konfiguracji?
Z góry dziękujemy za wszelkie wskazówki.
, jeśli uzyskasz prawidłową odpowiedź. proszę wybrać odpowiedź – chaosguru
zabawne, szukałem sposobu drukowania komunikatów debugowania przez długi czas i tam to masz – Blub