I migrated my application from log4j to log4j2. I changed every configuration from log4j to log4j2 standards (file name and syntax) but I have this error:
ERROR Recursive call to appender RootConsole
This is my configuration:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="RootConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ISO8601} %c{1} [%t] %p - %m%n"/>
</Console>
<RollingFile name="IntegrationTestFile" fileName="it_test.log"
filePattern="integration_test.log.%i">
<PatternLayout pattern="%d{ISO8601} %c{1} [%t] %p - %m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="100 KB"/>
</Policies>
<DefaultRolloverStrategy max="1"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="RootConsole"/>
<AppenderRef ref="IntegrationTestFile"/>
</Root>
</Loggers>
</Configuration>
This error appears when I exclude one of two module "pl.package.x" or in the same way "pl.package.y":
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="RootConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ISO8601} %c{1} [%t] %p - %m%n"/>
</Console>
<RollingFile name="IntegrationTestFile" fileName="it_test.log"
filePattern="integration_test.log.%i">
<PatternLayout pattern="%d{ISO8601} %c{1} [%t] %p - %m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="100 KB"/>
</Policies>
<DefaultRolloverStrategy max="1"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="RootConsole"/>
<AppenderRef ref="IntegrationTestFile"/>
</Root>
<!-- Logger which I added -->
<Logger name="pl.package.x" level="DEBUG" additivity="false">
<AppenderRef ref="RootConsole"/>
<AppenderRef ref="IntegrationTestFile"/>
</Logger>
</Loggers>
</Configuration>
This logger catches everything from "pl.package.x" package and next append it to "RootConsole" and "IntegrationTestFile", the same as root logger. So - if "pl.package.x" or "pl.package.y" is catching by another logger and didn't send events to root logger (additivity="false") everything working correctly - if not I have "ERROR Recursive call to appended".
Maybe someone knows where can be recursive invocations and how fix it?