log4j2 stops writing to file after few logs - log4j2
I am working with log4j2. The logger initializes and creates output logfile. After writing few logs logger stops and does not write anything. The logger logs are as below:
`DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Converter' found 45 plugins
DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger Starting LoggerContext[name=3bb8aabc, org.apache.logging.log4j.core.LoggerContext#73010765]...
DEBUG StatusLogger Reconfiguration started for context[name=3bb8aabc] at URI null (org.apache.logging.log4j.core.LoggerContext#73010765) with optional ClassLoader: null
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Missing dependencies for Yaml support, ConfigurationFactory org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory is inactive
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Missing dependencies for Json support, ConfigurationFactory org.apache.logging.log4j.core.config.json.JsonConfigurationFactory is inactive
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory#26b95b0b
WARN StatusLogger Error parsing URI C:\myApplication\config\logger-config.xml
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Closing FileInputStream java.io.FileInputStream#245ec1a6
DEBUG StatusLogger Apache Log4j Core 2.18.0 initializing configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml]
DEBUG StatusLogger PluginManager 'Core' found 130 plugins
DEBUG StatusLogger PluginManager 'Level' found 0 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
TRACE StatusLogger TypeConverterRegistry initializing.
DEBUG StatusLogger PluginManager 'TypeConverter' found 26 plugins
DEBUG StatusLogger PatternLayout$Builder(pattern="[%d] [%t] [%-5p] [%l][%M] %m%n", PatternSelector=null, Configuration(C:\myApplication\config\logger-config.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
DEBUG StatusLogger PluginManager 'Converter' found 45 plugins
DEBUG StatusLogger Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
DEBUG StatusLogger TimeBasedTriggeringPolicy$Builder(interval="null", modulate="null", maxRandomDelay="null")
DEBUG StatusLogger Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
DEBUG StatusLogger createPolicy(size="1000KB")
DEBUG StatusLogger Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
DEBUG StatusLogger createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)})
DEBUG StatusLogger Building Plugin[name=DefaultRolloverStrategy, class=org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy].
DEBUG StatusLogger DefaultRolloverStrategy$Builder(max="5", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="null", tempCompressedFilePattern="null", Configuration(C:\myApplication\config\logger-config.xml))
DEBUG StatusLogger Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender].
DEBUG StatusLogger RollingFileAppender$Builder(fileName="C:/logs/applicationLogs.log", filePattern="C:/logs_backup/${date:yyyy-MM}/applicationLogs-%d{MM-dd-yyyy}-%i.log.gz", append="null", locking="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=5, useMax=true)), advertise="null", advertiseUri="null", createOnDemand="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout([%d] [%t] [%-5p] [%l][%M] %m%n), name="CASRollingfileAppender", Configuration(C:\myApplication\config\logger-config.xml), Filter=null, ={})
TRACE StatusLogger New file 'C:/logs/applicationLogs.log' created = true
DEBUG StatusLogger Returning file creation time for C:\logs\applicationLogs.log
DEBUG StatusLogger Starting RollingFileManager C:/logs/applicationLogs.log
DEBUG StatusLogger PluginManager 'FileConverter' found 2 plugins
DEBUG StatusLogger Setting prev file time to 2022-12-06T23:48:23.928-0800
DEBUG StatusLogger Initializing triggering policy CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)])
DEBUG StatusLogger Initializing triggering policy TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)
TRACE StatusLogger PatternProcessor.getNextTime returning 2022/12/07-00:00:00.000, nextFileTime=2022/12/06-00:00:00.000, prevFileTime=1969/12/31-16:00:00.000, current=2022/12/06-23:48:23.959, freq=DAILY
TRACE StatusLogger PatternProcessor.getNextTime returning 2022/12/07-00:00:00.000, nextFileTime=2022/12/06-00:00:00.000, prevFileTime=2022/12/06-00:00:00.000, current=2022/12/06-23:48:23.959, freq=DAILY
DEBUG StatusLogger Initializing triggering policy SizeBasedTriggeringPolicy(size=1024000)
DEBUG StatusLogger Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
DEBUG StatusLogger createAppenders(={CASRollingfileAppender})
DEBUG StatusLogger Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
DEBUG StatusLogger createAppenderRef(ref="CASRollingfileAppender", level="null", Filter=null)
DEBUG StatusLogger Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
DEBUG StatusLogger LoggerConfig$Builder(additivity="false", level="DEBUG", levelAndRefs="null", name="com.test.myApplication.logging", includeLocation="null", ={CASRollingfileAppender}, ={}, Configuration(C:\myApplication\config\logger-config.xml), Filter=null)
DEBUG StatusLogger Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
DEBUG StatusLogger createAppenderRef(ref="CASRollingfileAppender", level="null", Filter=null)
DEBUG StatusLogger Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
DEBUG StatusLogger LoggerConfig$RootLogger$Builder(additivity="null", level="WARN", levelAndRefs="null", includeLocation="null", ={CASRollingfileAppender}, ={}, Configuration(C:\myApplication\config\logger-config.xml), Filter=null)
DEBUG StatusLogger Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
DEBUG StatusLogger createLoggers(={com.test.myApplication.logging, root})
DEBUG StatusLogger Configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml] initialized
DEBUG StatusLogger Starting configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml]
DEBUG StatusLogger Started configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml] OK.
TRACE StatusLogger Stopping org.apache.logging.log4j.core.config.DefaultConfiguration#608bc8f8...
TRACE StatusLogger DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
TRACE StatusLogger DefaultConfiguration stopping root LoggerConfig.
TRACE StatusLogger DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
TRACE StatusLogger DefaultConfiguration stopping remaining Appenders.
DEBUG StatusLogger Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger OutputStream closed
DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
DEBUG StatusLogger Appender DefaultConsole-1 stopped with status true
TRACE StatusLogger DefaultConfiguration stopped 1 remaining Appenders.
TRACE StatusLogger DefaultConfiguration cleaning Appenders from 1 LoggerConfigs.
DEBUG StatusLogger Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#608bc8f8 OK
TRACE StatusLogger Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector#2a3194c6
TRACE StatusLogger Reregistering context (1/1): '3bb8aabc' org.apache.logging.log4j.core.LoggerContext#73010765
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=StatusLogger'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=ContextSelector'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Appenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=AsyncAppenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=AsyncLoggerRingBuffer'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=*,subtype=RingBuffer'
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=StatusLogger
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=ContextSelector
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=com.test.myApplication.logging
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Appenders,name=CASRollingfileAppender
TRACE StatusLogger Using default SystemClock for timestamps.
DEBUG StatusLogger org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
TRACE StatusLogger Using DummyNanoClock for nanosecond timestamps.
DEBUG StatusLogger Reconfiguration complete for context[name=3bb8aabc] at URI C:\myApplication\config\logger-config.xml (org.apache.logging.log4j.core.LoggerContext#73010765) with optional ClassLoader: null
DEBUG StatusLogger Shutdown hook enabled. Registering a new one.
DEBUG StatusLogger LoggerContext[name=3bb8aabc, org.apache.logging.log4j.core.LoggerContext#73010765] started OK.
DEBUG StatusLogger AsyncLogger.ThreadNameStrategy=UNCACHED (user specified null, default is UNCACHED)
TRACE StatusLogger Using default SystemClock for timestamps.
DEBUG StatusLogger org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
and the logger config file as:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="CASRollingfileAppender"
fileName="C:/logs/applicationLogs.log"
filePattern="C:/logs_backup/$${date:yyyy-MM}/applicationLogs-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="[%d] [%t] [%-5p] [%l][%M] %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="1000KB" />
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
</Appenders>
<Loggers>
<Logger
name="com.test.myApplication.logging"
level="DEBUG" additivity="false">
<AppenderRef ref="CASRollingfileAppender" />
</Logger>
<Root level="WARN">
<AppenderRef ref="CASRollingfileAppender" />
</Root>
</Loggers>
</Configuration>
Any suggestions on what is going wrong here?
In logs it shows a warning as:
WARN StatusLogger Error parsing URI C:\myApplication\config\logger-config.xml
However, I think the config file is working properly. Why does the logger stop writing after it writes a few logs?
Related
Tomcat Reports Resource Name Lookup Error on startup
I have several containerized applications which run in numerous locations. The application containers are based on a Tomcat container then customized accordingly for the application. Each application makes a connection to a containerized mariadb instance co-located on the same server. The JNDI Resource for the database connection is specified globally in the respective web app container server.xml. In one location, one of the applications connects just fine to the mariadb container while the second application throws a NamingContext.lookup error immediately when tomcat starts. I have verified the global resource is exactly the same between the applications. I also verified the resource config is the same in both applications webapp_root/META-INF/context.xml. Here are the relevant parts: NOTE: All variable values are defined and supplied for the respective catalina.properties file and the values are the same Application A JNDI Resource definition for server.xml <Resource name="jdbc/menudb" auth="Container" driverClassName="com.mysql.cj.jdbc.Driver" initialSize="25" logAbandoned="true" minEvictableIdleTimeMillis="30000" minIdle="10" maxActive="50" maxIdle="20" maxWait="1000" removeAbandonedOnBorrow="true" removeAbandonedOnMaintenance="true" removeAbandonedTimeout="15" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="300000" type="javax.sql.DataSource" username="${mfg.jdbc.menudb.user}" password="${mfg.jdbc.menudb.password}" url="${mfg.jdbc.menudb.url}"/> Application B JNDI Resource definition for server.xml <Resource name="jdbc/menudb" auth="Container" driverClassName="com.mysql.cj.jdbc.Driver" initialSize="25" logAbandoned="true" minEvictableIdleTimeMillis="30000" minIdle="10" maxActive="50" maxIdle="20" maxWait="1000" removeAbandonedOnBorrow="true" removeAbandonedOnMaintenance="true" removeAbandonedTimeout="15" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="300000" type="javax.sql.DataSource" username="${mfg.jdbc.menudb.user}" password="${mfg.jdbc.menudb.password}" url="${mfg.jdbc.menudb.url}"/> Application A Context.xml <?xml version="1.0" encoding="UTF-8"?> <Context docBase="mfgweb" path="/..." reloadable="true" swallowOutput="true"> <ResourceLink global="jdbc/menudb" name="jdbc/menudb" type="javax.sql.DataSource" /> <ResourceLink global="localas400" name="localas400" type="javax.sql.DataSource" /> <ResourceLink global="corpas400" name="corpas400" type="javax.sql.DataSource" /> <ResourceLink global="gaims" name="gaims" type="javax.sql.DataSource" /> </Context> Application B Context.xml <?xml version="1.0" encoding="UTF-8"?> <Context docBase="menuadmin" path="/..." privileged="true" debug="4" crossContext="true"> <ResourceLink name="jdbc/menudb" global="jdbc/menudb" type="javax.sql.DataSource" /> </Context> NOTE: Application A utilizes additional JNDI connections, but the entry for jdbc/menudb are the same. Here is the full error recorded in Application B docker log 12-Aug-2021 15:41:10.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.21 12-Aug-2021 15:41:11.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 4 2019 20:19:36 UTC 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.21.0 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-693.21.1.el7.x86_64 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-8/jre 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_212-b04 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat 12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.library.path=/usr/lib 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djavax.net.ssl.trustStore=/usr/local/tomcat/conf/cacerts 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djavax.net.ssl.trustStorePassword=*** 12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.auth.login.config=/usr/local/tomcat/conf/jaas.config 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom ... 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/usr/local/tomcat/lib/applicationinsights-agent-2.5.1.jar 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat 12-Aug-2021 15:41:11.021 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat 12-Aug-2021 15:41:11.021 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp 12-Aug-2021 15:41:11.632 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 12-Aug-2021 15:41:11.682 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 12-Aug-2021 15:41:11.684 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1,416] milliseconds 12-Aug-2021 15:41:11.721 WARNING [main] org.apache.naming.NamingContext.lookup Unexpected exception resolving reference java.lang.NullPointerException at org.apache.naming.factory.ResourceFactory.getDefaultFactory(ResourceFactory.java:45) at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:90) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) at org.apache.naming.NamingContext.lookup(NamingContext.java:840) at org.apache.naming.NamingContext.lookup(NamingContext.java:159) at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:134) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:925) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) 12-Aug-2021 15:41:11.722 SEVERE [main] org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans Exception processing global JNDI Resources javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.lang.NullPointerException] at org.apache.naming.NamingContext.lookup(NamingContext.java:856) at org.apache.naming.NamingContext.lookup(NamingContext.java:159) at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71) at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:134) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101) at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:925) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:633) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) Caused by: java.lang.NullPointerException at org.apache.naming.factory.ResourceFactory.getDefaultFactory(ResourceFactory.java:45) at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:90) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321) at org.apache.naming.NamingContext.lookup(NamingContext.java:840) ... 20 more 12-Aug-2021 15:41:11.887 WARNING [main] com.hazelcast.config.AbstractXmlConfigHelper.null Name of the hazelcast schema location is incorrect, using default 12-Aug-2021 15:41:12.063 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 12-Aug-2021 15:41:12.063 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.21] 12-Aug-2021 15:41:12.100 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/****.war] Does anyone see a reason why Application A works and can connect to the database just fine while Application B reports it cannot find the resource due to a Null Pointer exception? This is extremely frustrating and this particular location has been without the use of Application B for a few months now.
For Tomcat 9 you need to define the correct factory for the resource, e.g.: <Resource name="jdbc/menudb" auth="Container" driverClassName="com.mysql.cj.jdbc.Driver" initialSize="25" logAbandoned="true" minEvictableIdleTimeMillis="30000" minIdle="10" maxActive="50" maxIdle="20" maxWait="1000" removeAbandonedOnBorrow="true" removeAbandonedOnMaintenance="true" removeAbandonedTimeout="15" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="300000" username="${mfg.jdbc.menudb.user}" password="${mfg.jdbc.menudb.password}" url="${mfg.jdbc.menudb.url}" jdbcInterceptors="StatementCache" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" type="org.apache.tomcat.jdbc.pool.DataSource" />
log4j2 auto-initialization disable is not working with isLog4jAutoInitializationDisabled <context-parm>
emphasized textI'm working on migration of log4j version from 1.2.17 to Log4j2 , as part of migration I have chosen bridge option as per the guideliness , while migrating log4j.xml to log4j2.xml for RollingFile we are having properties to substitute for file creation as below <RollingFile name="file" fileName="${log.directory}server.log.${log.id}server.log" filePattern="${log.directory}server.log.${log.id}server.log"> <PatternLayout pattern="%d{ISO8601} %-5p (%t %X{RequestId} %X{CallerId}) [%c{1}] %m%n" /> <Policies> <SizeBasedTriggeringPolicy size="5000 KB" /> </Policies> <DefaultRolloverStrategy max="5" /> </RollingFile> And these variables resolved after execution of one of custom (com.MyCustomListener) written during startup , This flow is working as expected with log4j 1.2.17 . With log4j2 as per the Specification provided by apache auto-initialization of log4j2 happens during server startup automatically , due to this auto-initialization at the being of server startup my listener which resolves variables is executing after initialization of log4j as a result variables are not resolving, I am using servlet version 4.0 I tried to disable auto-initialization by adding below beginning of my web.xml <context-param> <param-name>isLog4jAutoInitializationDisabled</param-name> <param-value>true</param-value> </context-param> But still this is not helping me , log4j2 initialization is happening before my execution I want my execution first before log4j2 initialization. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>MyApplication</display-name> <listener> <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class> </listener> <filter> <filter-name>log4jServletFilter</filter-name> <filter-class>org.apache.logging.log4j.web.Log4jServletFilter</filter-class> </filter> <filter-mapping> <filter-name>log4jServletFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <context-param> <param-name>isLog4jAutoInitializationDisabled</param-name> <param-value>true</param-value> </context-param> <!-- init properties shared by entire application --> <context-param> <param-name>earDeploymentDescriptorPath</param-name> <param-value>application.xml</param-value> </context-param> <listener> <listener-class>com.MyCustomListener</listener-class> </listener> <!-- bootstrap Log4j --> <!-- Log4j refresh interval --> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param> <context-param> <param-name>log4jExposeWebAppRoot</param-name> <param-value>false</param-value> </context-param> <!-- welcome file list--> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> I have enabled TRACE logs for log4j2 , From the logs I have observed that log4j is initializing before my custom listener(com.MyCustomListener) *2021-05-19 05:11:49,314 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,314 ServerService Thread Pool -- 71 TRACE TypeConverterRegistry initializing. 2021-05-19 05:11:49,314 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,314 ServerService Thread Pool -- 71 DEBUG PluginManager 'TypeConverter' found 26 plugins 2021-05-19 05:11:49,330 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,330 ServerService Thread Pool -- 71 DEBUG PatternLayout$Builder(pattern="%d{ISO8601} %-5p (%t) [%c{1}] %m%n", PatternSelector=null, Configuration(vfs:/C:/SL3/CPS_EMR_ALL/jboss/standalone/deployments/PracticeEAR.ear/lib/Practice.jar/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null") 2021-05-19 05:11:49,330 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,330 ServerService Thread Pool -- 71 DEBUG PluginManager 'Converter' found 46 plugins 2021-05-19 05:11:49,330 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,330 ServerService Thread Pool -- 71 DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender]. 2021-05-19 05:11:49,345 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,345 ServerService Thread Pool -- 71 DEBUG ConsoleAppender$Builder(target="SYSTEM_OUT", follow="null", direct="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d{ISO8601} %-5p (%t) [%c{1}] %m%n), name="console", Configuration(vfs:/C:/SL3/CPS_EMR_ALL/jboss/standalone/deployments/PracticeEAR.ear/lib/Practice.jar/log4j2.xml), Filter=null, ={}) 2021-05-19 05:11:49,345 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,345 ServerService Thread Pool -- 71 DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false 2021-05-19 05:11:49,345 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,345 ServerService Thread Pool -- 71 DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2021-05-19 05:11:49,345 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19 05:11:49,345 ServerService Thread Pool -- 71 DEBUG PatternLayout$Builder(pattern="%d{ISO8601} %-5p (%t %X{RequestId} %X{CallerId}) [%c{1}] %m%n", PatternSelector=null, Configuration(vfs:/C:/SL3/CPS_EMR_ALL/jboss/standalone/deployments/PracticeEAR.ear/lib/Practice.jar/log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null") 2021-05-19 05:11:49,580 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19T05:11:49,580 INFO (ServerService Thread Pool -- 71) [MyCustomListner] ********************** Entry to MyCustomListner class ********************** 2021-05-19 05:11:49,611 INFO [stdout] (ServerService Thread Pool -- 71) 2021-05-19T05:11:49,611 ERROR (ServerService Thread Pool -- 71) [MyCustomListner] ********************** Exit from MyCustomListner class *********************** Your help is apricated
log4j2 is logging to console only and not logging to a file after server shutdown/startup
I have a pivotal tc server SE running. There is a springboot web app deployed with log4j2 logging framework configured. The log4j2 properties has console and file logging enabled with TimeBasedTriggeringPolicy enabled which creates new file every day with the date appended to the previous date. The logging seemed to be working fine until recently where the server was taken down for maintenance. Issue: The logs are not being written to custom file(File logging) anymore after the server startup. I can still see console logging happen. Re-deploy isn't fixing the problem too. Note: The server shutdown and startup was done on different days. Not sure if this information matters. Log4j2 startup logs when Configuration status = debug 2020-01-30 08:39:21,459 background-preinit DEBUG Initializing configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#63c4d792 2020-01-30 08:39:21,464 background-preinit DEBUG Installed script engines 2020-01-30 08:39:22,328 background-preinit DEBUG PluginManager 'Core' found 97 plugins 2020-01-30 08:39:22,328 background-preinit DEBUG PluginManager 'Level' found 0 plugins 2020-01-30 08:39:22,333 background-preinit DEBUG No scheduled items 2020-01-30 08:39:22,335 background-preinit DEBUG Building Plugin[name=property, class=org.apache.logging.log4j.core.config.Property]. 2020-01-30 08:39:22,356 background-preinit DEBUG PluginManager 'TypeConverter' found 23 plugins 2020-01-30 08:39:22,382 background-preinit DEBUG createProperty(name="filename", value="logs") 2020-01-30 08:39:22,383 background-preinit DEBUG Building Plugin[name=properties, class=org.apache.logging.log4j.core.config.PropertiesPlugin]. 2020-01-30 08:39:22,393 background-preinit DEBUG configureSubstitutor(={filename=logs}, Configuration(LoggingConfig)) 2020-01-30 08:39:22,394 background-preinit DEBUG PluginManager 'Lookup' found 13 plugins 2020-01-30 08:39:22,396 background-preinit DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2020-01-30 08:39:22,396 background-preinit DEBUG createAppenderRef(ref="StdoutAppender", level="null", Filter=null) 2020-01-30 08:39:22,397 background-preinit DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2020-01-30 08:39:22,399 background-preinit DEBUG createAppenderRef(ref="DailyRollingAppender", level="null", Filter=null) 2020-01-30 08:39:22,399 background-preinit DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger]. 2020-01-30 08:39:22,401 background-preinit DEBUG createLogger(additivity="null", level="INFO", includeLocation="null", ={StdoutAppender, DailyRollingAppender}, ={}, Configuration(LoggingConfig), Filter=null) 2020-01-30 08:39:22,405 background-preinit DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin]. 2020-01-30 08:39:22,406 background-preinit DEBUG createLoggers(={root}) 2020-01-30 08:39:22,406 background-preinit DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2020-01-30 08:39:22,414 background-preinit DEBUG PatternLayout$Builder(pattern="%d{ISO8601} [%t] %-5p (%F:%L) - %m%n", PatternSelector=null, Configuration(LoggingConfig), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 2020-01-30 08:39:22,415 background-preinit DEBUG PluginManager 'Converter' found 41 plugins 2020-01-30 08:39:22,452 background-preinit DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender]. 2020-01-30 08:39:22,456 background-preinit INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory. 2020-01-30 08:39:22,457 background-preinit DEBUG PluginManager 'Converter' found 41 plugins 2020-01-30 08:39:22,464 background-preinit DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2 2020-01-30 08:39:22,471 background-preinit DEBUG ConsoleAppender$Builder(PatternLayout(%d{ISO8601} [%t] %-5p (%F:%L) - %m%n), Filter=null, target="null", name="StdoutAppender", follow="null", ignoreExceptions="null") 2020-01-30 08:39:22,488 background-preinit DEBUG Starting OutputStreamManager SYSTEM_OUT.false 2020-01-30 08:39:22,488 background-preinit DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2020-01-30 08:39:22,490 background-preinit DEBUG PatternLayout$Builder(pattern="%d{ISO8601} [%t] %-5p (%F:%L) - %m%n", PatternSelector=null, Configuration(LoggingConfig), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 2020-01-30 08:39:22,491 background-preinit DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy]. 2020-01-30 08:39:22,494 background-preinit DEBUG createPolicy(interval="1", modulate="null") 2020-01-30 08:39:22,495 background-preinit DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy]. 2020-01-30 08:39:22,495 background-preinit DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)}) 2020-01-30 08:39:22,496 background-preinit DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender]. 2020-01-30 08:39:22,499 background-preinit DEBUG createAppender(fileName="logs/App.log", filePattern="logs/App-%d{yyyy-MM-dd-hh-mm}.log", append="null", name="DailyRollingAppender", bufferedIO="null", bufferSize="null", immediateFlush="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)])), Strategy=null, PatternLayout(%d{ISO8601} [%t] %-5p (%F:%L) - %m%n), Filter=null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(LoggingConfig)) 2020-01-30 08:39:22,509 background-preinit DEBUG Starting RollingFileManager logs/App.log 2020-01-30 08:39:22,524 background-preinit DEBUG PluginManager 'FileConverter' found 2 plugins 2020-01-30 08:39:22,527 background-preinit DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin]. 2020-01-30 08:39:22,528 background-preinit DEBUG createAppenders(={StdoutAppender, DailyRollingAppender}) 2020-01-30 08:39:22,529 background-preinit DEBUG Configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#63c4d792 initialized 2020-01-30 08:39:22,530 background-preinit DEBUG Starting configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#63c4d792 2020-01-30 08:39:22,530 background-preinit DEBUG Started configuration org.apache.logging.log4j.core.config.properties.PropertiesConfiguration#63c4d792 OK. 2020-01-30 08:39:22,531 background-preinit DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1 2020-01-30 08:39:22,531 background-preinit DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#44b5581b OK 2020-01-30 08:39:22,551 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75 2020-01-30 08:39:22,554 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=StatusLogger 2020-01-30 08:39:22,556 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=ContextSelector 2020-01-30 08:39:22,558 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Loggers,name= 2020-01-30 08:39:22,572 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Appenders,name=StdoutAppender 2020-01-30 08:39:22,572 background-preinit DEBUG Registering MBean org.apache.logging.log4j2:type=29647f75,component=Appenders,name=DailyRollingAppender 2020-01-30 08:39:22,578 background-preinit DEBUG Reconfiguration complete for context[name=29647f75] at URI NULL_SOURCE (org.apache.logging.log4j.core.LoggerContext#19276473) with optional ClassLoader: null 2020-01-30 08:39:22,579 background-preinit DEBUG Shutdown hook enabled. Registering a new one. 2020-01-30 08:39:22,580 background-preinit DEBUG LoggerContext[name=29647f75, org.apache.logging.log4j.core.LoggerContext#19276473] started OK. 2020-01-30 08:39:22,629 background-preinit DEBUG RollingFileManager executing synchronous FileRenameAction[logs/App.log to logs/App-2020-01-30-08-36.log, renameEmptyFiles=false]
Log4j2 Async logger
This is my log4j2.xml file (abbreviated, there are 4 more appenders and loggers, but all of them with exactly the same format): <?xml version="1.0" encoding="UTF-8"?> <Configuration status="trace" name="ventusproxy" packages=""> <Appenders> <RollingFile name="ACCESS_LOG" filePattern="${sys:log.dir}vproxy_access.%d{yyyy-MM-dd}" append="true" immediateFlush="false"> <PatternLayout> <Pattern>%m%d{yyyy-MM-dd HH:mm:ss}%n</Pattern> </PatternLayout> <Policies> <TimeBasedTriggeringPolicy/> </Policies> </RollingFile> </Appenders> <Loggers> <Root level="off" additivity="false" /> <Logger name="LOGGER_ACCESS" level="info" includeLocation="true" additivity="false"> <AppenderRef ref="ACCESS_LOG"/> </Logger> </Loggers> </Configuration> We start tomcat with the option: -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector So we enable full async logging. That's why we are simply using Logger and Root instead of AsyncLogger and AsyncRoot. When tomcat starts, we can see: 2018-08-07 21:03:56,535 localhost-startStop-1 TRACE Using default SystemClock for timestamps. 2018-08-07 21:03:56,536 localhost-startStop-1 TRACE Using DummyNanoClock for nanosecond timestamps. 2018-08-07 21:03:56,536 localhost-startStop-1 DEBUG Reconfiguration complete for context[name=AsyncContext#4d8d549e] at URI /home/ventusproxy/app/ROOT/WEB-INF/log4j.xml (org.apache.logging.log4j.core.async.AsyncLoggerContext#2c9ae56e) with optional ClassLoader: null 2018-08-07 21:03:56,536 localhost-startStop-1 DEBUG Shutdown hook enabled. Registering a new one. 2018-08-07 21:03:56,537 localhost-startStop-1 DEBUG LoggerContext[name=AsyncContext#4d8d549e, org.apache.logging.log4j.core.async.AsyncLoggerContext#2c9ae56e] started OK. 2018-08-07 21:03:56,538 localhost-startStop-1 TRACE Using default SystemClock for timestamps. 2018-08-07 21:03:56,539 localhost-startStop-1 DEBUG AsyncLogger.ThreadNameStrategy=CACHED 2018-08-07 21:03:56,556 Log4j2-TF-1-AsyncLogger[AsyncContext#4d8d549e]-1 DEBUG Now writing to /home/ventusproxy/logs/vproxy_system.2018-08-07 at 2018-08-07T21:03:56.556-0400 2018-08-07 21:03:57,081 localhost-startStop-1 DEBUG PluginManager 'Converter' found 42 plugins 2018-08-07 21:03:57,082 localhost-startStop-1 DEBUG Starting OutputStreamManager SYSTEM_OUT.false.false-2 2018-08-07 21:03:57,083 localhost-startStop-1 TRACE [DefaultAsyncContext#localhost-startStop-1] AsyncLoggerDisruptor creating new disruptor for this context. 2018-08-07 21:03:57,083 localhost-startStop-1 TRACE property AsyncLogger.WaitStrategy=TIMEOUT 2018-08-07 21:03:57,092 localhost-startStop-1 DEBUG [DefaultAsyncContext#localhost-startStop-1] Starting AsyncLogger disruptor for this context with ringbufferSize=262144, waitStrategy=TimeoutBlockingWaitStrategy, exceptionHandler=org.apache.logging.log4j.core.async.AsyncLoggerDefaultExceptionHandler#71fd86cb... 2018-08-07 21:03:57,093 localhost-startStop-1 TRACE [DefaultAsyncContext#localhost-startStop-1] AsyncLoggers use a threadlocal translator 2018-08-07 21:03:57,093 localhost-startStop-1 DEBUG Starting LoggerContext[name=DefaultAsyncContext#localhost-startStop-1, org.apache.logging.log4j.core.async.AsyncLoggerContext#77ae266d]... 2018-08-07 21:03:57,094 localhost-startStop-1 DEBUG Reconfiguration started for context[name=DefaultAsyncContext#localhost-startStop-1] at URI null (org.apache.logging.log4j.core.async.AsyncLoggerContext#77ae266d) with optional ClassLoader: null 2018-08-07 21:03:57,094 localhost-startStop-1 DEBUG Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory#4b6e6fdf 2018-08-07 21:03:57,133 localhost-startStop-1 DEBUG Initializing configuration XmlConfiguration[location=/home/ventusproxy/app/ROOT/WEB-INF/log4j.xml] And finally (last debug line): 2018-08-07 21:03:57,200 localhost-startStop-1 DEBUG LoggerContext[name=DefaultAsyncContext#localhost-startStop-1, org.apache.logging.log4j.core.async.AsyncLoggerContext#77ae266d] started OK. But when we perform a thread dump with JStack, instead of seeing one thread we see 2 threads: "Log4j2-TF-7-AsyncLogger[DefaultAsyncContext#localhost-startStop-1]-2" #23 daemon prio=5 os_prio=0 tid=0x00007f1ee8ad9800 nid=0x625d runnable [0x00007f1f05817000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000000925d3ad8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) at com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(TimeoutBlockingWaitStrategy.java:38) at com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56) at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:124) at java.lang.Thread.run(Thread.java:748) Locked ownable synchronizers: - None "Log4j2-TF-1-AsyncLogger[AsyncContext#4d8d549e]-1" #21 daemon prio=5 os_prio=0 tid=0x00007f1ee88d8800 nid=0x625c runnable [0x00007f1f06073000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x0000000093099540> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) at com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(TimeoutBlockingWaitStrategy.java:38) at com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56) at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:124) at java.lang.Thread.run(Thread.java:748) Locked ownable synchronizers: - None And when we stop tomcat, all these errors are logged: 07-Aug-2018 21:07:29.991 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Log4j2-TF-7-AsyncLogger[DefaultAsyncContext#localhost-startStop-1]-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) com.lmax.disruptor.TimeoutBlockingWaitStrategy.waitFor(TimeoutBlockingWaitStrategy.java:38) com.lmax.disruptor.ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:56) com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:124) java.lang.Thread.run(Thread.java:748) 07-Aug-2018 21:07:29.993 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#494a6bc6]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#46d89786]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.993 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#494a6bc6]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#7fca5b63]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.994 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#7d2c87bb]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#316c8d06]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.994 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#74afa5d5]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#5913f960]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.994 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#401baca6]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#154a0d1e]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.995 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#1cc2936f]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#5a5ca16e]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 07-Aug-2018 21:07:29.995 SEVERE [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#473f581f]) and a value of type [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator] (value [org.apache.logging.log4j.core.async.RingBufferLogEventTranslator#2d89f1b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. So just 3 questions because now I'm not sure if I'm using asynchronous logging here: With these traces can I confirm I'm using full asynchronous logging? I've read that async logging starts just one thread, but here I see 2 (like when we mix sync and async logging). Is this true? How can I remove these errors from the catalina.out? The application stops correctly so these messages are not really a problem, but I'd prefer to remove them if it's possible.
Fastest Log4j2 configuration for multiple java process / multiple machine production environment
We have 4 java processes running on machine01, 1 java process on machine02, 2 java processes on machine03. We would like them to all write logging to the same file on machine01. What is the best config to accomplish this? We need production grade very fast high throughput logging. Right now we have a 5th process on machine01, ecplogger, that runs the UdpSocketServer and uses RollingRandomAccessFile Appender wrapped with Failover Appender. All other processes on machine01, machine02 and machine03 write to a Socket Appender wrapped with an Async appender wrapped with a Failover Appender. It works sort of, however I get these errors in the main java process on machine01 and I get lots of logging to the Failover appender: 2016-02-05 18:23:06,123 AsyncAppender-local_process_async ERROR Unable to write to stream UDP:ecplogger:6000 for appender local_process_socket 2016-02-05 18:34:50,746 AsyncAppender-local_process_async ERROR Unable to write to stream UDP:ecplogger:6000 for appender local_process_socket 2016-02-05 18:47:25,233 Log4j2-AsyncLogger[AsyncContext#18b4aac2]1 ERROR Appender local_process_async is unable to write primary appenders. queue is full 2016-02-05 18:47:25,234 Log4j2-AsyncLogger[AsyncContext#18b4aac2]1 ERROR Appender local_process_async is unable to write primary appenders. queue is full 2016-02-05 18:47:25,235 Log4j2-AsyncLogger[AsyncContext#18b4aac2]1 ERROR Appender local_process_async is unable to write primary appenders. queue is full 2016-02-05 18:47:25,236 Log4j2-AsyncLogger[AsyncContext#18b4aac2]1 ERROR Appender local_process_async is unable to write primary appenders. queue is full 2016-02-06 01:56:44,647 AsyncAppender-local_process_async ERROR Unable to write to stream UDP:ecplogger:6000 for appender local_process_socket 2016-02-06 06:02:13,308 AsyncAppender-local_process_async ERROR Unable to write to stream UDP:ecplogger:6000 for appender local_process_socket 2016-02-07 06:40:36,386 AsyncAppender-local_process_async ERROR Unable to write to stream UDP:ecplogger:6000 for appender local_process_socket Configuration: Every java process is started with: -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector \ -DAsyncLogger.ExceptionHandler=com.twc.ctg.ecp.service.EcpExceptionHandler \ The ecplogger java process that runs UdpSocketServer uses the config: <?xml version="1.0" encoding="UTF-8"?> <!-- Used by ecplogger --> <Configuration name="log4j2.server.xml" status="debug" monitorInterval="60"> <Appenders> <!-- Don't forget to set system property -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -DAsyncLogger.ExceptionHandler=com.twc.ctg.ecp.service.EcpExceptionHandler --> <!--Asynchronous loggers and appenders will automatically flush at the end of a batch of events, even if immediateFlush is set to false --> <!-- The default buffer size is 262144 bytes, double it--> <RollingRandomAccessFile name="RollingRandomAccessFile" fileName="/opt/twc/logs/ecp.log" filePattern="/opt/twc/logs/ecp.log.%d{yyyy-MM-dd}" append="true" bufferSize="524288" ignoreExceptions="false"> <PatternLayout> <Pattern>%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n</Pattern> </PatternLayout> <Policies> <TimeBasedTriggeringPolicy/> </Policies> </RollingRandomAccessFile> <Console name="STDERR" target="SYSTEM_ERR"> <PatternLayout pattern="%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n"></PatternLayout> </Console> <Failover name="Failover" primary="RollingRandomAccessFile"> <Failovers> <AppenderRef ref="STDERR"/> </Failovers> </Failover> </Appenders> <Loggers> <Root level="all"> <AppenderRef ref="Failover"/> </Root> </Loggers> </Configuration> All other java processes use the config: <?xml version="1.0" encoding="UTF-8"?> <!-- Used by every process --> <Configuration status="debug" name="log4j2.xml" monitorInterval="60"> <Appenders> <Socket name="local_process_socket" host="ecplogger" port="6000" protocol="UDP" immediateFail="false" immediateFlush="true" reconnectionDelayMillis="1000" connectTimeoutMillis="10000" ignoreExceptions="false"> <SerializedLayout/> </Socket> <!-- Don't forget to set system properties in ecp.conf -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -DAsyncLogger.ExceptionHandler=com.twc.ctg.ecp.service.EcpExceptionHandler --> <Async name="local_process_async" blocking="false" shutdownTimeout="5000" bufferSize="32768" errorRef="STDERR" ignoreExceptions="false" includeLocation="false"> <AppenderRef ref="local_process_socket"/> </Async> <Console name="STDERR" target="SYSTEM_ERR"> <PatternLayout pattern="%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n"></PatternLayout> </Console> <Failover name="Failover" primary="local_process_async"> <Failovers> <AppenderRef ref="STDERR"/> </Failovers> </Failover> </Appenders> <Loggers> <Logger name="com.google" level="error"/> <Logger name="org.mybatis" level="error"/> <Logger name="org.apache.ibatis" level="error"/> <Logger name="com.ryantenney" level="error"/> <Logger name="org.apache.http" level="error"/> <Logger name="org.apache.activemq" level="error"/> <Logger name="org.eclipse.jetty" level="error"/> <Logger name="org.apache.cxf" level="error"/> <Logger name="org.springframework" level="info"/> <Logger name="com.twc.ctg.ecp.service.history.HouseholdHistorySummaryQueue" level="warn"/> <Logger name="com.twc.ctg.ecp.persistence.mappers.HouseholdHistorySummaryMapper" level="warn"/> <Root level="info"> <AppenderRef ref="Failover"/> </Root> </Loggers> </Configuration> Log4j2 output on debug Ecplogger, the UdpSocketServer: 2016-02-05 18:17:36,228 main DEBUG Initializing configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.server.xml] 2016-02-05 18:17:36,274 main DEBUG Installed script engines 2016-02-05 18:17:39,738 main DEBUG Oracle Nashorn Version: 1.8.0_65, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript} 2016-02-05 18:17:39,903 main DEBUG Groovy Scripting Engine Version: 2.0, Language: Groovy, Threading: MULTITHREADED, Compile: true, Names: {groovy, Groovy} 2016-02-05 18:17:39,903 main DEBUG PluginManager 'Core' found 97 plugins 2016-02-05 18:17:39,907 main DEBUG PluginManager 'Level' found 0 plugins 2016-02-05 18:17:39,958 main DEBUG Starting 1 Log4j2Scheduled threads 2016-02-05 18:17:39,980 main DEBUG PluginManager 'Lookup' found 13 plugins 2016-02-05 18:17:39,983 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2016-02-05 18:17:40,089 main DEBUG PluginManager 'TypeConverter' found 23 plugins 2016-02-05 18:17:40,332 main DEBUG PatternLayout$Builder(pattern="%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n", PatternSelector=null, Configuration(log4j2.server.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 2016-02-05 18:17:40,347 main DEBUG PluginManager 'Converter' found 38 plugins 2016-02-05 18:17:40,486 main DEBUG Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy]. 2016-02-05 18:17:40,585 main DEBUG createPolicy(interval="null", modulate="null") 2016-02-05 18:17:40,585 main DEBUG Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy]. 2016-02-05 18:17:40,587 main DEBUG createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)}) 2016-02-05 18:17:40,587 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender]. 2016-02-05 18:17:40,628 main DEBUG createAppender(fileName="/opt/twc/logs/ecp.log", filePattern="/opt/twc/logs/ecp.log.%d{yyyy-MM-dd}", append="true", name="RollingRandomAccessFile", immediateFlush="null", bufferSize="524288", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)])), Strategy=null, PatternLayout(%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n), Filter=null, ignoreExceptions="false", advertise="null", advertiseURI="null", Configuration(log4j2.server.xml)) 2016-02-05 18:17:40,672 main DEBUG Starting RollingRandomAccessFileManager /opt/twc/logs/ecp.log 2016-02-05 18:17:40,673 main DEBUG PluginManager 'FileConverter' found 2 plugins 2016-02-05 18:17:40,727 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2016-02-05 18:17:40,729 main DEBUG PatternLayout$Builder(pattern="%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n", PatternSelector=null, Configuration(log4j2.server.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 2016-02-05 18:17:40,730 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender]. 2016-02-05 18:17:40,754 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory. 2016-02-05 18:17:40,755 main DEBUG PluginManager 'Converter' found 38 plugins 2016-02-05 18:17:40,760 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2 2016-02-05 18:17:40,830 main DEBUG ConsoleAppender$Builder(PatternLayout(%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n), Filter=null, target="SYSTEM_ERR", name="STDERR", follow="null", ignoreExceptions="null") 2016-02-05 18:17:40,830 main DEBUG Starting OutputStreamManager SYSTEM_ERR.false 2016-02-05 18:17:40,831 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2016-02-05 18:17:40,831 main DEBUG createAppenderRef(ref="STDERR", level="null", Filter=null) 2016-02-05 18:17:40,873 main DEBUG Building Plugin[name=failovers, class=org.apache.logging.log4j.core.appender.FailoversPlugin]. 2016-02-05 18:17:40,876 main DEBUG createFailovers(={STDERR}) 2016-02-05 18:17:40,876 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.FailoverAppender]. 2016-02-05 18:17:40,899 main ERROR appender Failover has no parameter that matches element Failovers 2016-02-05 18:17:40,899 main DEBUG createAppender(name="Failover", primary="RollingRandomAccessFile", ={[STDERR]}, retryIntervalSeconds="null", Configuration(log4j2.server.xml), Filter=null, ignoreExceptions="null") 2016-02-05 18:17:40,900 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin]. 2016-02-05 18:17:40,930 main DEBUG createAppenders(={RollingRandomAccessFile, STDERR, Failover primary=null, failover={STDERR}}) 2016-02-05 18:17:40,941 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2016-02-05 18:17:40,942 main DEBUG createAppenderRef(ref="Failover", level="null", Filter=null) 2016-02-05 18:17:40,942 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger]. 2016-02-05 18:17:40,943 main DEBUG createLogger(additivity="null", level="ALL", includeLocation="null", ={Failover}, ={}, Configuration(log4j2.server.xml), Filter=null) 2016-02-05 18:17:40,970 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin]. 2016-02-05 18:17:40,971 main DEBUG createLoggers(={root}) 2016-02-05 18:17:40,972 main DEBUG Configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.server.xml] initialized 2016-02-05 18:17:40,972 main DEBUG Starting configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.server.xml] 2016-02-05 18:17:41,030 main DEBUG Started configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.server.xml] OK. 2016-02-05 18:17:41,031 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1 2016-02-05 18:17:41,031 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#3339ad8e OK 2016-02-05 18:17:41,570 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3 2017-02-05 18:17:41,585 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=AsyncLoggerRingBuffer 2016-02-05 18:17:41,587 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=StatusLogger 2016-02-05 18:17:41,618 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=ContextSelector 2016-02-05 18:17:41,639 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=Loggers,name= 2016-02-05 18:17:41,641 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=Appenders,name=STDERR 2016-02-05 18:17:41,662 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=Appenders,name=Failover 2016-02-05 18:17:41,662 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#17f052a3,component=Appenders,name=RollingRandomAccessFile 2016-02-05 18:17:41,683 main DEBUG Reconfiguration complete for context[name=AsyncContext#17f052a3] at URI /opt/twc/ecp/log4j2.server.xml (org.apache.logging.log4j.core.async.AsyncLoggerContext#6bf0219d) with optional ClassLoader: null 2016-02-05 18:17:41,692 main DEBUG Shutdown hook enabled. Registering a new one. 2016-02-05 18:17:41,693 main DEBUG LoggerContext[name=AsyncContext#17f052a3, org.apache.logging.log4j.core.async.AsyncLoggerContext#6bf0219d] started OK. 2016-02-05 18:17:41,727 main DEBUG AsyncLogger.ThreadNameStrategy=CACHED 2016-02-06 00:00:00,416 Log4j2-0 DEBUG RollingFileManager executing synchronous FileRenameAction[/opt/twc/logs/ecp.log to /opt/twc/logs/ecp.log.2016-02-05, renameEmptyFiles=false] 2016-02-07 00:00:00,663 Log4j2-0 DEBUG RollingFileManager executing synchronous FileRenameAction[/opt/twc/logs/ecp.log to /opt/twc/logs/ecp.log.2016-02-06, renameEmptyFiles=false] 2016-02-08 00:00:00,802 Log4j2-0 DEBUG RollingFileManager executing synchronous FileRenameAction[/opt/twc/logs/ecp.log to /opt/twc/logs/ecp.log.2016-02-07, renameEmptyFiles=false] ~ One of the other processes: 2016-02-05 18:17:37,098 main DEBUG Initializing configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.xml] 2016-02-05 18:17:37,159 main DEBUG Installed script engines 2016-02-05 18:17:37,356 main DEBUG Groovy Scripting Engine Version: 2.0, Language: Groovy, Threading: MULTITHREADED, Compile: true, Names: {groovy, Groovy} 2016-02-05 18:17:40,741 main DEBUG Oracle Nashorn Version: 1.8.0_65, Language: ECMAScript, Threading: Not Thread Safe, Compile: true, Names: {nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript} 2016-02-05 18:17:40,742 main DEBUG PluginManager 'Core' found 97 plugins 2016-02-05 18:17:40,743 main DEBUG PluginManager 'Level' found 0 plugins 2016-02-05 18:17:40,813 main DEBUG Starting 1 Log4j2Scheduled threads 2016-02-05 18:17:40,814 main DEBUG PluginManager 'Lookup' found 13 plugins 2016-02-05 18:17:40,847 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.SerializedLayout]. 2016-02-05 18:17:40,864 main DEBUG createLayout() 2016-02-05 18:17:40,865 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.SocketAppender]. 2016-02-05 18:17:41,080 main DEBUG PluginManager 'TypeConverter' found 23 plugins 2016-02-05 18:17:41,178 main DEBUG createAppender(host="ecplogger", port="6000", protocol="UDP", SSL=null, connectTimeoutMillis="10000", reconnectionDelayMillis="1000", immediateFail="false", name="local_process_socket", immediateFlush="true", ignoreExceptions="false", SerializedLayout(org.apache.logging.log4j.core.layout.SerializedLayout#4e3958e7), Filter=null, advertise="false", Configuration(log4j2.xml)) 2016-02-05 18:17:41,233 main DEBUG Starting DatagramSocketManager UDP:ecplogger:6000 2016-02-05 18:17:41,234 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2016-02-05 18:17:41,253 main DEBUG createAppenderRef(ref="local_process_socket", level="null", Filter=null) 2016-02-05 18:17:41,253 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.AsyncAppender]. 2016-02-05 18:17:41,295 main DEBUG createAppender(={local_process_socket}, errorRef="STDERR", blocking="false", shutdownTimeout="5000", bufferSize="32768", name="local_process_async", includeLocation="false", Filter=null, Configuration(log4j2.xml), ignoreExceptions="false") 2016-02-05 18:17:41,296 main DEBUG Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout]. 2016-02-05 18:17:41,336 main DEBUG PatternLayout$Builder(pattern="%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n", PatternSelector=null, Configuration(log4j2.xml), Replace=null, charset="null", alwaysWriteExceptions="null", noConsoleNoAnsi="null", header="null", footer="null") 2016-02-05 18:17:41,366 main DEBUG PluginManager 'Converter' found 38 plugins 2016-02-05 18:17:41,509 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.ConsoleAppender]. 2016-02-05 18:17:41,512 main INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory. 2016-02-05 18:17:41,529 main DEBUG PluginManager 'Converter' found 38 plugins 2016-02-05 18:17:41,530 main DEBUG Starting OutputStreamManager SYSTEM_OUT.false-2 2016-02-05 18:17:41,573 main DEBUG ConsoleAppender$Builder(PatternLayout(%d{ISO8601} %-14mdc{application} %-5level [%t] %logger - %msg%n), Filter=null, target="SYSTEM_ERR", name="STDERR", follow="null", ignoreExceptions="null") 2016-02-05 18:17:41,574 main DEBUG Starting OutputStreamManager SYSTEM_ERR.false 2016-02-05 18:17:41,576 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2016-02-05 18:17:41,602 main DEBUG createAppenderRef(ref="STDERR", level="null", Filter=null) 2016-02-05 18:17:41,603 main DEBUG Building Plugin[name=failovers, class=org.apache.logging.log4j.core.appender.FailoversPlugin]. 2016-02-05 18:17:41,603 main DEBUG createFailovers(={STDERR}) 2016-02-05 18:17:41,604 main DEBUG Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.FailoverAppender]. 2016-02-05 18:17:41,606 main ERROR appender Failover has no parameter that matches element Failovers 2016-02-05 18:17:41,609 main DEBUG createAppender(name="Failover", primary="local_process_async", ={[STDERR]}, retryIntervalSeconds="null", Configuration(log4j2.xml), Filter=null, ignoreExceptions="null") 2016-02-05 18:17:41,610 main DEBUG Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin]. 2016-02-05 18:17:41,611 main DEBUG createAppenders(={local_process_socket, local_process_async, STDERR, Failover primary=null, failover={STDERR}}) 2016-02-05 18:17:41,619 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,627 main DEBUG createLogger(additivity="null", level="ERROR", name="com.google", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,660 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,670 main DEBUG createLogger(additivity="null", level="ERROR", name="org.mybatis", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,671 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,672 main DEBUG createLogger(additivity="null", level="ERROR", name="org.apache.ibatis", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,672 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,688 main DEBUG createLogger(additivity="null", level="ERROR", name="com.ryantenney", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,688 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,689 main DEBUG createLogger(additivity="null", level="ERROR", name="org.apache.http", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,702 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,703 main DEBUG createLogger(additivity="null", level="ERROR", name="org.apache.activemq", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,703 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,704 main DEBUG createLogger(additivity="null", level="ERROR", name="org.eclipse.jetty", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,704 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,717 main DEBUG createLogger(additivity="null", level="ERROR", name="org.apache.cxf", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,720 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,721 main DEBUG createLogger(additivity="null", level="INFO", name="org.springframework", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,721 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,722 main DEBUG createLogger(additivity="null", level="WARN", name="com.twc.ctg.ecp.service.history.HouseholdHistorySummaryQueue", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,734 main DEBUG Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig]. 2016-02-05 18:17:41,735 main DEBUG createLogger(additivity="null", level="WARN", name="com.twc.ctg.ecp.persistence.mappers.HouseholdHistorySummaryMapper", includeLocation="null", ={}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,735 main DEBUG Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef]. 2016-02-05 18:17:41,735 main DEBUG createAppenderRef(ref="Failover", level="null", Filter=null) 2016-02-05 18:17:41,736 main DEBUG Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger]. 2016-02-05 18:17:41,737 main DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={Failover}, ={}, Configuration(log4j2.xml), Filter=null) 2016-02-05 18:17:41,746 main DEBUG Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin]. 2016-02-05 18:17:41,747 main DEBUG createLoggers(={com.google, org.mybatis, org.apache.ibatis, com.ryantenney, org.apache.http, org.apache.activemq, org.eclipse.jetty, org.apache.cxf, org.springframework, com.twc.ctg.ecp.service.history.HouseholdHistorySummaryQueue, com.twc.ctg.ecp.persistence.mappers.HouseholdHistorySummaryMapper, root}) 2016-02-05 18:17:41,750 main DEBUG Configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.xml] initialized 2016-02-05 18:17:41,756 main DEBUG Starting configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.xml] 2016-02-05 18:17:41,764 main DEBUG Started configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.xml] OK. 2016-02-05 18:17:41,764 main DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false-1 2016-02-05 18:17:41,765 main DEBUG Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#1324409e OK 2016-02-05 18:17:41,771 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2 2016-02-05 18:17:41,774 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=AsyncLoggerRingBuffer 2016-02-05 18:17:41,780 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=StatusLogger 2016-02-05 18:17:41,783 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=ContextSelector 2016-02-05 18:17:41,790 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.apache.ibatis 2016-02-05 18:17:41,791 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name= 2016-02-05 18:17:41,792 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=com.google 2016-02-05 18:17:41,792 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.apache.activemq 2016-02-05 18:17:41,792 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.eclipse.jetty 2016-02-05 18:17:41,793 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=com.twc.ctg.ecp.persistence.mappers.HouseholdHistorySummaryMapper 2016-02-05 18:17:41,794 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.apache.cxf 2016-02-05 18:17:41,794 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.apache.http 2016-02-05 18:17:41,794 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.apache.http 2016-02-05 18:17:41,795 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=com.twc.ctg.ecp.service.history.HouseholdHistorySummaryQueue 2016-02-05 18:17:41,800 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.springframework 2016-02-05 18:17:41,800 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=com.ryantenney 2016-02-05 18:17:41,802 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Loggers,name=org.mybatis 2016-02-05 18:17:41,809 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Appenders,name=local_process_socket 2016-02-05 18:17:41,811 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Appenders,name=STDERR 2016-02-05 18:17:41,811 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=Appenders,name=Failover 2016-02-05 18:17:41,813 main DEBUG Registering MBean org.apache.logging.log4j2:type=AsyncContext#18b4aac2,component=AsyncAppenders,name=local_process_async 2016-02-05 18:17:41,818 main DEBUG Reconfiguration complete for context[name=AsyncContext#18b4aac2] at URI /opt/twc/ecp/log4j2.xml (org.apache.logging.log4j.core.async.AsyncLoggerContext#2cd2a21f) with optional ClassLoader: null 2016-02-05 18:17:41,824 main DEBUG Shutdown hook enabled. Registering a new one. 2016-02-05 18:17:41,825 main DEBUG LoggerContext[name=AsyncContext#18b4aac2, org.apache.logging.log4j.core.async.AsyncLoggerContext#2cd2a21f] started OK. 2016-02-05 18:17:41,841 main DEBUG AsyncLogger.ThreadNameStrategy=CACHED ~