2016-07-19 9 views
0

Ich bin überrascht, dass log4j2 keine Nachrichten ausgibt, wenn es in einem Thread ausgeführt wird.log4j2 druckt keine Nachrichten in einem Thread

Einzelheiten

  • log4j2 Version 2.6.2
  • Debug und Laufzeit betroffen
  • zwei Standardappen (Datei, Konsole)
  • Anrufe wie LOG.error("msg");, LOG.error("msg", e); oder LOG.info("bad news", e);
  • läuft in einem sepa Rate Thread und alle nachfolgenden LOG Anrufe werden nicht
  • Eclipse-Mars Mitteilung (4.5.0)
  • Java JDK 1.8.0_51
  • Maven 3.x Projekt dargestellt, sondern aus Eclipse-
  • Win 7 (Professional gestartet
  • )

Init

private static final Logger LOG = LogManager.getLogger(MainProcess.class);

Konfiguration

<?xml version="1.0" encoding="UTF-8"?> 
<Configuration xmlns="http://logging.apache.org/log4j/2.0/config" packages="xyz.my.appenders"> 
<Appenders> 
    <File name="file" fileName="logfile.log" append="true"> 
     <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n"/> 
    </File> 
    <Console name="console" target="SYSTEM_OUT"> 
     <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n"/> 
    </Console> 
    <LimitAppender name="log-viewer" numberOfLines="30"> 
     <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n"/> 
    </LimitAppender> 
</Appenders> 
<Loggers> 
    <Logger name="xyz.my.application" level="DEBUG"/> 
    <Root level="DEBUG"> 
     <AppenderRef ref="console"/> 
     <AppenderRef ref="file"/> 
     <!-- <AppenderRef ref="log-viewer"/> --> 
    </Root> 
</Loggers> 
</Configuration> 

Spur von log4j2 (200 von 283 Zeilen)

2016-07-20 09:42:14,396 main DEBUG Initializing configuration XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml] 
2016-07-20 09:42:14,409 main DEBUG Installed script engines 
2016-07-20 09:42:15,040 main DEBUG Oracle Nashorn Version: 1.8.0_51, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript} 
2016-07-20 09:42:15,115 main DEBUG Took 0.074225 seconds to load 1 plugins from package xyz.my.appenders 
2016-07-20 09:42:15,115 main DEBUG PluginManager 'Core' found 100 plugins 
2016-07-20 09:42:15,116 main DEBUG PluginManager 'Level' found 0 plugins 
2016-07-20 09:42:15,119 main DEBUG No scheduled items 
2016-07-20 09:42:15,119 main DEBUG PluginManager 'Lookup' found 13 plugins 
2016-07-20 09:42:15,121 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 
2016-07-20 09:42:15,132 main TRACE TypeConverterRegistry initializing. 
2016-07-20 09:42:15,132 main DEBUG PluginManager 'TypeConverter' found 23 plugins 
2016-07-20 09:42:15,144 main DEBUG PatternLayout$Builder(pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n", PatternSelector=null, Configuration(C:\...\TheProject\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 
2016-07-20 09:42:15,145 main DEBUG PluginManager 'Converter' found 41 plugins 
2016-07-20 09:42:15,179 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.FileAppender]. 
2016-07-20 09:42:15,185 main DEBUG createAppender(fileName="logfile.log", append="true", locking="null", name="file", immediateFlush="null", ignoreExceptions="null", bufferedIo="null", bufferSize="null", PatternLayout(%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n), Filter=null, advertise="null", advertiseUri="null", Configuration(C:\...\TheProject\target\classes\log4j2.xml)) 
2016-07-20 09:42:15,189 main DEBUG Starting FileManager logfile.log 
2016-07-20 09:42:15,189 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 
2016-07-20 09:42:15,190 main DEBUG PatternLayout$Builder(pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n", PatternSelector=null, Configuration(C:\...\TheProject\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 
2016-07-20 09:42:15,190 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender]. 
2016-07-20 09:42:15,192 main DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin. 
2016-07-20 09:42:15,193 main DEBUG PluginManager 'Converter' found 41 plugins 
2016-07-20 09:42:15,194 main DEBUG Jansi is not installed, cannot find org.fusesource.jansi.WindowsAnsiOutputStream 
2016-07-20 09:42:15,194 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2 
2016-07-20 09:42:15,202 main DEBUG ConsoleAppender$Builder(PatternLayout(%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n), Filter=null, target="SYSTEM_OUT", name="console", follow="null", ignoreExceptions="null") 
2016-07-20 09:42:15,203 main DEBUG Jansi is not installed, cannot find org.fusesource.jansi.WindowsAnsiOutputStream 
2016-07-20 09:42:15,204 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false 
2016-07-20 09:42:15,204 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 
2016-07-20 09:42:15,204 main DEBUG PatternLayout$Builder(pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n", PatternSelector=null, Configuration(C:\...\TheProject\target\classes\log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 
2016-07-20 09:42:15,205 main DEBUG Building Plugin[name=appender, class=xyz.my.appenders.LimitMemoryAppender]. 
2016-07-20 09:42:15,205 main DEBUG createAppender(name="log-viewer", PatternLayout(%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%p] %C{2} (%F:%L) - %m%n), numberOfLines="30") 
2016-07-20 09:42:15,206 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin]. 
2016-07-20 09:42:15,207 main DEBUG createAppenders(={file, console, log-viewer}) 
2016-07-20 09:42:15,207 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 
2016-07-20 09:42:15,210 main DEBUG createLogger(additivity="true", level="DEBUG", name="xyz.my.project", includeLocation="null", ={}, ={}, Configuration(C:\...\TheProject\target\classes\log4j2.xml), Filter=null) 
2016-07-20 09:42:15,213 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 
2016-07-20 09:42:15,214 main DEBUG createAppenderRef(ref="console", level="null", Filter=null) 
2016-07-20 09:42:15,214 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 
2016-07-20 09:42:15,214 main DEBUG createAppenderRef(ref="file", level="null", Filter=null) 
2016-07-20 09:42:15,214 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 
2016-07-20 09:42:15,215 main DEBUG createAppenderRef(ref="log-viewer", level="null", Filter=null) 
2016-07-20 09:42:15,215 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger]. 
2016-07-20 09:42:15,216 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={console, file, log-viewer}, ={}, Configuration(C:\...\TheProject\target\classes\log4j2.xml), Filter=null) 
2016-07-20 09:42:15,217 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin]. 
2016-07-20 09:42:15,217 main DEBUG createLoggers(={xyz.my.project, root}) 
2016-07-20 09:42:15,219 main DEBUG Configuration XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml] initialized 
2016-07-20 09:42:15,219 main DEBUG Starting configuration XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml] 
2016-07-20 09:42:15,219 main DEBUG Started configuration XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml] OK. 
2016-07-20 09:42:15,220 main TRACE Stopping [email protected]54... 
2016-07-20 09:42:15,220 main TRACE DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped. 
2016-07-20 09:42:15,221 main TRACE DefaultConfiguration stopping root LoggerConfig. 
2016-07-20 09:42:15,221 main TRACE DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped. 
2016-07-20 09:42:15,222 main TRACE DefaultConfiguration stopping remaining Appenders. 
2016-07-20 09:42:15,222 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1 
2016-07-20 09:42:15,222 main TRACE DefaultConfiguration stopped 1 remaining Appenders. 
2016-07-20 09:42:15,222 main TRACE DefaultConfiguration cleaning Appenders from 1 LoggerConfigs. 
2016-07-20 09:42:15,222 main DEBUG Stopped [email protected]54 OK 
2016-07-20 09:42:15,295 main TRACE Reregistering MBeans after reconfigure. Selector=or[email protected]74e52ef6 
2016-07-20 09:42:15,295 main TRACE Reregistering context (1/1): 'c387f44' [email protected] 
2016-07-20 09:42:15,297 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44' 
2016-07-20 09:42:15,297 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=StatusLogger' 
2016-07-20 09:42:15,298 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=ContextSelector' 
2016-07-20 09:42:15,298 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=Loggers,name=*' 
2016-07-20 09:42:15,298 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=Appenders,name=*' 
2016-07-20 09:42:15,299 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=AsyncAppenders,name=*' 
2016-07-20 09:42:15,299 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=AsyncLoggerRingBuffer' 
2016-07-20 09:42:15,299 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=Loggers,name=*,subtype=RingBuffer' 
2016-07-20 09:42:15,301 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44 
2016-07-20 09:42:15,303 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=StatusLogger 
2016-07-20 09:42:15,305 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=ContextSelector 
2016-07-20 09:42:15,307 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name= 
2016-07-20 09:42:15,308 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Loggers,name=xyz.my.myproject 
2016-07-20 09:42:15,309 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=console 
2016-07-20 09:42:15,310 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=file 
2016-07-20 09:42:15,310 main DEBUG Registering MBean org.apache.logging.log4j2:type=c387f44,component=Appenders,name=log-viewer 
2016-07-20 09:42:15,312 main TRACE Using default SystemClock for timestamps. 
2016-07-20 09:42:15,312 main TRACE Using DummyNanoClock for nanosecond timestamps. 
2016-07-20 09:42:15,312 main DEBUG Reconfiguration complete for context[name=c387f44] at URI C:\...\TheProject\target\classes\log4j2.xml ([email protected]) with optional ClassLoader: null 
2016-07-20 09:42:15,313 main DEBUG Shutdown hook enabled. Registering a new one. 
2016-07-20 09:42:15,314 main DEBUG LoggerContext[name=c387f44, [email protected]] started OK. 
2016-07-20 09:42:15.501 [main] [DEBUG] main.SQLHelperMain (SQLHelperMain.java:95) - Adding icon 
2016-07-20 09:42:16.168 [Thread-2] [INFO] main.SQLHelperMain (SQLHelperMain.java:390) - SQLHelperMain.parsingFinished(true) 
2016-07-20 09:42:16.424 [main] [DEBUG] main.SQLHelperMain (SQLHelperMain.java:82) - Open SQLHelperUI 
2016-07-20 09:42:17,652 main DEBUG Stopping LoggerContext[name=c387f44, [email protected]]... 
2016-07-20 09:42:17,653 main TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=c387f44] 
2016-07-20 09:42:17,654 main TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=c387f44,component=StatusLogger] 
2016-07-20 09:42:17,654 main TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=c387f44,component=ContextSelector] 
2016-07-20 09:42:17,654 main TRACE Unregistering 2 MBeans: [org.apache.logging.log4j2:type=c387f44,component=Loggers,name=xyz.my.project, org.apache.logging.log4j2:type=c387f44,component=Loggers,name=] 
2016-07-20 09:42:17,655 main TRACE Unregistering 3 MBeans: [org.apache.logging.log4j2:type=c387f44,component=Appenders,name=console, org.apache.logging.log4j2:type=c387f44,component=Appenders,name=file, org.apache.logging.log4j2:type=c387f44,component=Appenders,name=log-viewer] 
2016-07-20 09:42:17,655 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=AsyncAppenders,name=*' 
2016-07-20 09:42:17,656 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=AsyncLoggerRingBuffer' 
2016-07-20 09:42:17,657 main TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=c387f44,component=Loggers,name=*,subtype=RingBuffer' 
2016-07-20 09:42:17,657 main TRACE Stopping XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml]... 
2016-07-20 09:42:17,658 main TRACE XmlConfiguration notified 3 ReliabilityStrategies that config will be stopped. 
2016-07-20 09:42:17,658 main TRACE XmlConfiguration stopping 2 LoggerConfigs. 
2016-07-20 09:42:17,658 main TRACE XmlConfiguration stopping root LoggerConfig. 
2016-07-20 09:42:17,658 main TRACE XmlConfiguration notifying ReliabilityStrategies that appenders will be stopped. 
2016-07-20 09:42:17,658 main TRACE XmlConfiguration stopping remaining Appenders. 
2016-07-20 09:42:17,658 main DEBUG Shutting down FileManager logfile.log 
2016-07-20 09:42:17,659 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false 
2016-07-20 09:42:17,659 main TRACE XmlConfiguration stopped 3 remaining Appenders. 
2016-07-20 09:42:17,659 main TRACE XmlConfiguration cleaning Appenders from 3 LoggerConfigs. 
2016-07-20 09:42:17,659 main DEBUG Stopped XmlConfiguration[location=C:\...\TheProject\target\classes\log4j2.xml] OK 
2016-07-20 09:42:17,660 main DEBUG Stopped LoggerContext[name=c387f44, [email protected]]... 
2016-07-20 09:42:27,713 AWT-EventQueue-0 DEBUG Not in a ServletContext environment, thus not loading WebLookup plugin. 
2016-07-20 09:42:27,713 AWT-EventQueue-0 DEBUG PluginManager 'Converter' found 41 plugins 
2016-07-20 09:42:27,715 AWT-EventQueue-0 DEBUG Jansi is not installed, cannot find org.fusesource.jansi.WindowsAnsiOutputStream 
2016-07-20 09:42:27,715 AWT-EventQueue-0 DEBUG Starting OutputStreamManager SYSTEM_OUT.false-3 
2016-07-20 09:42:27,716 AWT-EventQueue-0 DEBUG Starting LoggerContext[name=c387f44, [email protected]]... 
2016-07-20 09:42:27,716 AWT-EventQueue-0 DEBUG Reconfiguration started for context[name=c387f44] at URI null ([email protected]) with optional ClassLoader: null 
2016-07-20 09:42:27,716 AWT-EventQueue-0 DEBUG Using configurationFactory or[email protected]4d399216 
2016-07-20 09:42:27,716 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.properties] using context class loader [email protected] 
2016-07-20 09:42:27,717 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.properties] using [email protected] class loader. 
2016-07-20 09:42:27,717 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.properties] using [email protected] class loader. 
2016-07-20 09:42:27,718 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.properties] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,718 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yml] using context class loader [email protected] 
2016-07-20 09:42:27,719 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yml] using [email protected] class loader. 
2016-07-20 09:42:27,720 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yml] using [email protected] class loader. 
2016-07-20 09:42:27,721 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,721 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yaml] using context class loader [email protected] 
2016-07-20 09:42:27,722 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,722 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,723 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.yaml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,723 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.json] using context class loader [email protected] 
2016-07-20 09:42:27,724 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.json] using [email protected] class loader. 
2016-07-20 09:42:27,724 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.json] using [email protected] class loader. 
2016-07-20 09:42:27,724 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.json] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,725 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.jsn] using context class loader [email protected] 
2016-07-20 09:42:27,725 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,726 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,726 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.jsn] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,727 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.xml] using context class loader [email protected] 
2016-07-20 09:42:27,727 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.xml] using [email protected] class loader. 
2016-07-20 09:42:27,728 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.xml] using [email protected] class loader. 
2016-07-20 09:42:27,728 AWT-EventQueue-0 TRACE Trying to find [log4j2-testc387f44.xml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,728 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.properties] using context class loader [email protected] 
2016-07-20 09:42:27,729 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.properties] using [email protected] class loader. 
2016-07-20 09:42:27,729 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.properties] using [email protected] class loader. 
2016-07-20 09:42:27,730 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.properties] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,730 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yml] using context class loader [email protected] 
2016-07-20 09:42:27,731 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yml] using [email protected] class loader. 
2016-07-20 09:42:27,731 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yml] using [email protected] class loader. 
2016-07-20 09:42:27,732 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,732 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yaml] using context class loader [email protected] 
2016-07-20 09:42:27,732 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,733 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,733 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.yaml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,734 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.json] using context class loader [email protected] 
2016-07-20 09:42:27,734 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.json] using [email protected] class loader. 
2016-07-20 09:42:27,735 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.json] using [email protected] class loader. 
2016-07-20 09:42:27,735 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.json] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,735 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.jsn] using context class loader [email protected] 
2016-07-20 09:42:27,736 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,736 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,737 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.jsn] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,737 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.xml] using context class loader [email protected] 
2016-07-20 09:42:27,737 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.xml] using [email protected] class loader. 
2016-07-20 09:42:27,738 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.xml] using [email protected] class loader. 
2016-07-20 09:42:27,738 AWT-EventQueue-0 TRACE Trying to find [log4j2-test.xml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,738 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.properties] using context class loader [email protected] 
2016-07-20 09:42:27,739 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.properties] using [email protected] class loader. 
2016-07-20 09:42:27,739 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.properties] using [email protected] class loader. 
2016-07-20 09:42:27,740 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.properties] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,740 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yml] using context class loader [email protected] 
2016-07-20 09:42:27,740 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yml] using [email protected] class loader. 
2016-07-20 09:42:27,741 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yml] using [email protected] class loader. 
2016-07-20 09:42:27,741 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,742 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yaml] using context class loader [email protected] 
2016-07-20 09:42:27,742 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,742 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,743 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.yaml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,743 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.json] using context class loader [email protected] 
2016-07-20 09:42:27,744 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.json] using [email protected] class loader. 
2016-07-20 09:42:27,744 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.json] using [email protected] class loader. 
2016-07-20 09:42:27,744 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.json] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,745 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.jsn] using context class loader [email protected] 
2016-07-20 09:42:27,745 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,746 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.jsn] using [email protected] class loader. 
2016-07-20 09:42:27,746 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.jsn] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,746 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.xml] using context class loader [email protected] 
2016-07-20 09:42:27,747 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.xml] using [email protected] class loader. 
2016-07-20 09:42:27,747 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.xml] using [email protected] class loader. 
2016-07-20 09:42:27,747 AWT-EventQueue-0 TRACE Trying to find [log4j2c387f44.xml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,748 AWT-EventQueue-0 TRACE Trying to find [log4j2.properties] using context class loader [email protected] 
2016-07-20 09:42:27,748 AWT-EventQueue-0 TRACE Trying to find [log4j2.properties] using [email protected] class loader. 
2016-07-20 09:42:27,748 AWT-EventQueue-0 TRACE Trying to find [log4j2.properties] using [email protected] class loader. 
2016-07-20 09:42:27,749 AWT-EventQueue-0 TRACE Trying to find [log4j2.properties] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,749 AWT-EventQueue-0 TRACE Trying to find [log4j2.yml] using context class loader [email protected] 
2016-07-20 09:42:27,750 AWT-EventQueue-0 TRACE Trying to find [log4j2.yml] using [email protected] class loader. 
2016-07-20 09:42:27,750 AWT-EventQueue-0 TRACE Trying to find [log4j2.yml] using [email protected] class loader. 
2016-07-20 09:42:27,750 AWT-EventQueue-0 TRACE Trying to find [log4j2.yml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,751 AWT-EventQueue-0 TRACE Trying to find [log4j2.yaml] using context class loader [email protected] 
2016-07-20 09:42:27,751 AWT-EventQueue-0 TRACE Trying to find [log4j2.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,751 AWT-EventQueue-0 TRACE Trying to find [log4j2.yaml] using [email protected] class loader. 
2016-07-20 09:42:27,752 AWT-EventQueue-0 TRACE Trying to find [log4j2.yaml] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,752 AWT-EventQueue-0 TRACE Trying to find [log4j2.json] using context class loader [email protected] 
2016-07-20 09:42:27,753 AWT-EventQueue-0 TRACE Trying to find [log4j2.json] using [email protected] class loader. 
2016-07-20 09:42:27,753 AWT-EventQueue-0 TRACE Trying to find [log4j2.json] using [email protected] class loader. 
2016-07-20 09:42:27,753 AWT-EventQueue-0 TRACE Trying to find [log4j2.json] using ClassLoader.getSystemResource(). 
2016-07-20 09:42:27,754 AWT-EventQueue-0 TRACE Trying to find [log4j2.jsn] using context class loader [email protected] 
2016-07-20 09:42:27,754 AWT-EventQueue-0 TRACE Trying to find [log4j2.jsn] using [email protected] class loader. 

Bitte lassen Sie mich wissen, wenn Sie weitere Informationen wünschen.

+0

Ihre log4j-Konfiguration kann helfen :) – Berger

+0

@Berger: Es ist eine einfache einfache Konfiguration. Trotzdem werde ich es hinzufügen. – Markus

+0

Können Sie einen Beispiel-Thread zusammen mit der Erstellung von 'LOG' veröffentlichen? – Berger

Antwort

0

Dumme mir:

Anfangs schrieb ich eine Swing-Anwendung die Benutzeroberfläche über appl.setVisible(true); im Hauptgewindeöffnung. Am Ende fügte ich auch LogManager.shutdown(); hinzu, um die Ressourcen zu säubern, sobald sie beendet wurden.

Während Sie im Internet surfen und mehr Informationen über Swing über SO erhalten, hat sich der Code zu einer richtigen Multithread-Anwendung entwickelt (siehe SwingUtilities.invokeLater(new Runnable() {...});), während der Shutdown-Haken der LogManager beibehalten wird.

Fix

Aufgrund der hervorragenden gute Antwort von @rgoers sah ich, dass der Name des Loggers von xyz.my.logger geändert: DEBUG-xyz.my.logger: AUS!

+1

Bedenken Sie, dass Log4j 2 die notwendigen Bereinigungen automatisch in einem JVM-Shutdown-Hook durchführt, so dass Sie 'LogManager.shutdown()' nicht explizit aufrufen müssen. –

0

Ich würde gerne Ihre Anwendung sehen. Aus dem Protokoll sieht es so aus, als wäre die Anwendung beendet. AWT-EventQueue-0 (ein neuer Thread?) Beginnt dann zu laufen. Die Protokollierung wurde heruntergefahren, sodass versucht wird, sie neu zu initialisieren. Sie hat jedoch keine Ahnung, welche Konfiguration verwendet werden soll. Um dies zu beheben, müssen die Threads, die Ihre Anwendung erstellt, vor dem Ende des Hauptthreads ausgeführt werden.

+0

Das klingt wie ein sehr vielversprechender Input. Was mir in den Sinn kommt, ist: Wie kann ich eine Swing-Anwendung schreiben, wenn ich 'SwingUtilities.invokeLater (new Runnable() {...});'. Außerdem druckt es in Zeile 200+ noch einmal den korrekten Speicherort der Konfigurationsdatei. – Markus