Details
Description
We have been using log4j2 version 2.7 for a while and recently we have upgraded to log4j2 version 2.8.2 and the following stack trace started to appear. The following stack trace does not appear with log4j2 version 2.7. We googled a lot to find a solution, but can't find the exact source of the problem. If anyone can help, that would be great. The below is the actual stack trace and our xml config file.
Thank you.
Paul
2017-07-04 16:22:57,529 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.RollingFileAppender, element RollingFile. java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@3febb011] unable to create manager for [${sys:logfile}.error.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@7f0eb4b4[pattern=${sys:logfile}.error.%i.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[SizeBasedTriggeringPolicy(size=104857600)]), strategy=DefaultRolloverStrategy(min=1, max=1000, useMax=true), advertiseURI=null, layout=[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c{2}][%m]%n]] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:114) at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:155) at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:131) at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:60) at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122) at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884) at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508) at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551) 2017-07-04 16:22:57,530 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224) at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130) at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884) at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508) at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="debug" monitorInterval="10"> <Properties> <Property name="logFilePath">${sys:logfile}</Property> </Properties> <Appenders> <Console name="CONSOLE" target="SYSTEM_OUT"> <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/> </Console> <RollingFile name="LOG_FILE" fileName="${logFilePath}.log" filePattern="${logFilePath}.%i.log" immediateFlush="true"> <PatternLayout pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c][%m]%n"/> <Policies> <SizeBasedTriggeringPolicy size="100MB"/> </Policies> <DefaultRolloverStrategy max="1000"/> </RollingFile> <RollingFile name="ERROR_FILE" fileName="${logFilePath}.error.log" filePattern="${logFilePath}.error.%i.log" immediateFlush="true"> <PatternLayout pattern="[%d{yyyyMMdd.HH:mm:ss.SSS}:%-5level][%-17t][%-30c{2}][%m]%n"/> <Policies> <SizeBasedTriggeringPolicy size="100MB"/> </Policies> <DefaultRolloverStrategy max="1000"/> </RollingFile> </Appenders> <Loggers> <Logger name="a" level="warn" additivity="false"/> <Logger name="b" level="warn" additivity="false"/> <Logger name="c" level="warn" additivity="false"/> <Logger name="d" level="warn" additivity="false"/> <Logger name="e" level="warn" additivity="false"/> <Root level="debug" additivity="false"> <AppenderRef ref="LOG_FILE" level="debug"/> <AppenderRef ref="ERROR_FILE" level="error"/> </Root> </Loggers> </Configuration>