Deses Deses - 1 year ago 492
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">
<Console name="STDOUT" target="SYSTEM_OUT">
<Pattern>[%d{ISO8601}] %c [%C{1}] - %p: %m%n</Pattern>

<Syslog name="SYS_LOG" host="" port="514"
protocol="UDP" facility="LOCAL7">

<RollingFile name="backupApp"
<Pattern>[%d{ISO8601}] [%c] - %p: %m%n</Pattern>
<TimeBasedTriggeringPolicy interval="1"
modulate="true" />

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

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

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

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

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

Thanks for the help.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download