0
次log4j2.xml設定ファイル停止log4j2ロガーintitialzationは、次の出力が標準出力に出力され
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Properties>
<Property name="log-path">C:/logs</Property>
</Properties>
<Appenders>
<RollingFile name="RollingFile" fileName="${log-path}/myexample.log"
filePattern="${log-path}/myexample-%d{yyyy-MM-dd}-%i.log" >
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="1 KB" />
</Policies>
<DefaultRolloverStrategy max="4"/>
</RollingFile>
</Appenders>
<Loggers>
<Logger name="root" level="debug" additivity="false">
<appender-ref ref="RollingFile" level="debug"/>
</Logger>
</Loggers>
</Configuration>
をstdoutに印刷をログに記録します。
2016-08-22 19:21:59,384 main DEBUG Initializing configuration XmlConfiguration[location=jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml]
2016-08-22 19:21:59,415 main DEBUG Installed script engines
2016-08-22 19:22:00,509 main DEBUG Oracle Nashorn Version: 1.8.0_101, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript}
2016-08-22 19:22:00,509 main DEBUG PluginManager 'Core' found 99 plugins
2016-08-22 19:22:00,509 main DEBUG PluginManager 'Level' found 0 plugins
2016-08-22 19:22:00,524 main DEBUG No scheduled items
2016-08-22 19:22:00,524 main DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
2016-08-22 19:22:00,540 main DEBUG PluginManager 'TypeConverter' found 23 plugins
2016-08-22 19:22:00,571 main DEBUG createProperty(name="log-path", value="C:/logs")
2016-08-22 19:22:00,571 main DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin].
2016-08-22 19:22:00,571 main DEBUG configureSubstitutor(={log-path=C:/logs}, Configuration(jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml))
2016-08-22 19:22:00,587 main DEBUG PluginManager 'Lookup' found 13 plugins
2016-08-22 19:22:00,587 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
2016-08-22 19:22:00,587 main DEBUG PatternLayout$Builder(pattern="%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n", PatternSelector=null, Configuration(jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null")
2016-08-22 19:22:00,587 main DEBUG PluginManager 'Converter' found 41 plugins
2016-08-22 19:22:00,634 main DEBUG Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
2016-08-22 19:22:00,649 main DEBUG createPolicy(size="1 KB")
2016-08-22 19:22:00,649 main DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
2016-08-22 19:22:00,649 main DEBUG createPolicy(={SizeBasedTriggeringPolicy(size=1024)})
2016-08-22 19:22:00,649 main DEBUG Building Plugin[name=DefaultRolloverStrategy, class=org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy].
2016-08-22 19:22:00,665 main DEBUG createStrategy(max="4", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="true", Configuration(jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml))
2016-08-22 19:22:00,665 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender].
2016-08-22 19:22:00,680 main DEBUG createAppender(fileName="C:/logs/myexample.log", filePattern="C:/logs/myexample-%d{yyyy-MM-dd}-%i.log", append="null", name="RollingFile", bufferedIO="null", bufferSize="null", immediateFlush="null", Policies(CompositeTriggeringPolicy(policies=[SizeBasedTriggeringPolicy(size=1024)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=4)), PatternLayout(%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n), Filter=null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml))
2016-08-22 19:22:00,696 main DEBUG Starting RollingFileManager C:/logs/myexample.log
2016-08-22 19:22:00,696 main DEBUG PluginManager 'FileConverter' found 2 plugins
2016-08-22 19:22:00,696 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
2016-08-22 19:22:00,712 main DEBUG createAppenders(={RollingFile})
2016-08-22 19:22:00,712 main DEBUG Building Plugin[name=appender-ref, class=org.apache.logging.log4j.core.config.AppenderRef].
2016-08-22 19:22:00,712 main DEBUG createAppenderRef(ref="RollingFile", level="DEBUG", Filter=null)
2016-08-22 19:22:00,712 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
2016-08-22 19:22:00,727 main DEBUG createLogger(additivity="false", level="DEBUG", name="root", includeLocation="null", ={RollingFile}, ={}, Configuration(jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml), Filter=null)
2016-08-22 19:22:00,727 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
2016-08-22 19:22:00,727 main DEBUG createLoggers(={root})
2016-08-22 19:22:00,743 main DEBUG Configuration XmlConfiguration[location=jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml] initialized
2016-08-22 19:22:00,743 main DEBUG Starting configuration XmlConfiguration[location=jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml]
2016-08-22 19:22:00,743 main DEBUG Started configuration XmlConfiguration[location=jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml] OK.
2016-08-22 19:22:00,743 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
2016-08-22 19:22:00,759 main DEBUG Stopped [email protected]5 OK
2016-08-22 19:22:00,915 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44
2016-08-22 19:22:00,930 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=StatusLogger
2016-08-22 19:22:00,930 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=ContextSelector
2016-08-22 19:22:00,930 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=
2016-08-22 19:22:00,930 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=RollingFile
2016-08-22 19:22:00,946 main DEBUG Reconfiguration complete for context[name=c387f44] at URI jar:file:/C:/demo-program-1.0-SNAPSHOT.jar!/log4j2.xml ([email protected]) with optional ClassLoader: null
2016-08-22 19:22:00,946 main DEBUG Shutdown hook enabled. Registering a new one.
2016-08-22 19:22:00,946 main DEBUG LoggerContext[name=c387f44, [email protected]] started OK.
なぜこれらの初期化文が印刷されるのですか?
Thaks。ところで、設定出力を他のファイルロガーに設定することはできますか? –