Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Bug
-
2.12.1
-
None
-
Windows
Description
Hi,
I have a log4j2.xml configuration with 2 appenders:
- Console with JsonLayout
- RollingFile
In the Loggers section I use an AppenderRef for RollingFile.
Unfortunatelly, the file stays almost empty, compared to when I'm removing the console appender or when I replace the JsonLayout with a PatternLayout.
The jackson JARs are present. All logging related JARs:
- log4j-api-2.12.1
- log4j-core-2.12.1
- log4j-jul-2.12.1
- log4j-slf4j-impl-2.12.1
- log4j-web-2.12.1
- jcl-over-slf4j-1.7.28
- slf4j-api-1.7.28
- tomcat-extras-juli-adapters-9.0.0.M6
- jboss-logging-3.3.2.Final
- jackson-annotations-2.9.10
- jackson-core-2.9.10
- jackson-databind-2.9.10
Additional config:
-Dlog4j.configurationFile=file:config/log4j2.xml
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="ERROR" monitorInterval="60"> <Appenders> <Console name="ConsoleJson" target="SYSTEM_OUT"> <JsonLayout/> </Console> <RollingFile name="Rolling-File-Appender" fileName="logs/application.log" filePattern="logs/${date:yyyy-MM}/application-%d{yyyy-MM-dd-HH}-%i.log.gz"> <PatternLayout pattern="%d %p %c{1.} [%t] %m%n"/> <Policies> <SizeBasedTriggeringPolicy size="100 MB"/> <TimeBasedTriggeringPolicy interval="24" modulate="true"/> <OnStartupTriggeringPolicy/> </Policies> <DefaultRolloverStrategy max="100"> <Delete basePath="logs" maxDepth="2"> <IfFileName glob="*/application-*.log.gz"> <IfLastModified age="30d"/> </IfFileName> </Delete> </DefaultRolloverStrategy> </RollingFile> </Appenders> <Loggers> <Root level="INFO"> <AppenderRef ref="Rolling-File-Appender"/> </Root> </Loggers> </Configuration>
debug output:
INFO | jvm 1 | 2019/10/11 15:14:55 | DEBUG StatusLogger Unable to retrieve provider from ClassLoader java.net.URLClassLoader@11f2a1bf INFO | jvm 1 | 2019/10/11 15:14:55 | java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader.fail(ServiceLoader.java:239) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader.access$300(ServiceLoader.java:185) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$1.next(ServiceLoader.java:480) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:109) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:68) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:150) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:134) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Class.forName0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Class.forName(Class.java:348) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.tryLog4j2(LoggerProviders.java:125) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.findProvider(LoggerProviders.java:91) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:34) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:31) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getLogger(Logger.java:2465) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger$1.run(Logger.java:2565) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.security.AccessController.doPrivileged(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.weld.environment.servlet.logging.WeldServletLogger.<clinit>(WeldServletLogger.java:37) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:58) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1133) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1867) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.FutureTask.run(FutureTask.java:266) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1045) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:429) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.FutureTask.run(FutureTask.java:266) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Catalina.start(Catalina.java:633) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.reflect.Method.invoke(Method.java:498) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.reflect.Method.invoke(Method.java:498) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:429) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Thread.run(Thread.java:748) INFO | jvm 1 | 2019/10/11 15:14:55 | DEBUG StatusLogger Unable to retrieve provider from ClassLoader sun.misc.Launcher$AppClassLoader@5c647e05 INFO | jvm 1 | 2019/10/11 15:14:55 | java.util.ServiceConfigurationError: org.apache.logging.log4j.spi.Provider: Provider org.apache.logging.log4j.core.impl.Log4jProvider not a subtype INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader.fail(ServiceLoader.java:239) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader.access$300(ServiceLoader.java:185) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.ServiceLoader$1.next(ServiceLoader.java:480) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.loadProviders(ProviderUtil.java:109) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.<init>(ProviderUtil.java:68) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.lazyInit(ProviderUtil.java:150) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.util.ProviderUtil.hasProviders(ProviderUtil.java:134) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:89) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Class.forName0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Class.forName(Class.java:348) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.tryLog4j2(LoggerProviders.java:125) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.findProvider(LoggerProviders.java:91) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.find(LoggerProviders.java:34) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.LoggerProviders.<clinit>(LoggerProviders.java:31) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getLogger(Logger.java:2465) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger$1.run(Logger.java:2565) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.security.AccessController.doPrivileged(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.weld.environment.servlet.logging.WeldServletLogger.<clinit>(WeldServletLogger.java:37) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:58) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1133) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1867) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.FutureTask.run(FutureTask.java:266) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1045) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:429) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1576) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.FutureTask.run(FutureTask.java:266) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Catalina.start(Catalina.java:633) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.reflect.Method.invoke(Method.java:498) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2019/10/11 15:14:55 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.reflect.Method.invoke(Method.java:498) INFO | jvm 1 | 2019/10/11 15:14:55 | at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:429) INFO | jvm 1 | 2019/10/11 15:14:55 | at java.lang.Thread.run(Thread.java:748)