Deses Deses - 1 month ago 26
Java Question

Log4j2's FailoverAppender Error: appender Failover has no parameter that matches element Failovers

When I compile my spring 3.2.9 web application using log4j 2.1, this error appears in the console:

2015-02-02 12:08:25,213 ERROR appender Failover has no parameter that matches element Failovers


What I understand is that the element "Failovers" does not exist inside the element "Failover", right? Why would this happen? I don't see whats wrong since I have the same configuration as the log4j2 manual.

I have this configuration in my log4j2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration name="vcr-log4j2-config" status="debug">
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>[%d{ISO8601}] %c [%C{1}] - %p: %m%n</Pattern>
</PatternLayout>
</Console>

<Syslog name="SYS_LOG" host="test_server.com" port="514"
protocol="UDP" facility="LOCAL7">
</Syslog>

<RollingFile name="backupApp"
fileName="C:/backup.log"
filePattern="C:/backup-%d{yyyy-MM-dd_HH-mm}.log.gz">
<PatternLayout>
<Pattern>[%d{ISO8601}] [%c] - %p: %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />
</Policies>
</RollingFile>

<Failover name="FAILOVER" primary="SYS_LOG">
<Failovers>
<AppenderRef ref="backupApp"/>
</Failovers>
</Failover>
</Appenders>

<Loggers>
<Logger name="com.test.util.CustomLogger" level="info" additivity="false">
<AppenderRef ref="SYS_LOG" />
<AppenderRef ref="STDOUT" />
</Logger>

<Logger name="STDOUT" level="info" additivity="false">
<AppenderRef ref="STDOUT" />
</Logger>

<Root level="info">
<AppenderRef ref="STDOUT" />
<AppenderRef ref="LOG" />
</Root>

<Root level="error">
<AppenderRef ref="FAILOVER"/>
</Root>
</Loggers>
</Configuration>


Thanks for the help.

Answer

For anyone that runs into this problem, it's a bug in log4j2.

I ran into this JIRA issue and found this commentary in its xml config file:

<!-- set status below to FATAL to suppress a bug in log4j2: "ERROR appender Failover has no parameter that matches element Failovers" -->
<!--  other working value for status is "warn" -  -->

Not much else to do.

Comments