FailoverAppender is not starting

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FailoverAppender is not starting

Vina Martin
I’m seeing "ERROR appender Failover has no parameter that matches element Failovers” when I have a failover appender configured.
I have reported the issue here: https://issues.apache.org/jira/browse/LOG4J2-1973

The following is my configuration file, am I missing anything required to make the failover appender work?

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <RollingFile name="RollingFile" fileName="logs/app.log" filePattern="logs/app-%d{MM-dd-yyyy}.log.gz"
                     ignoreExceptions="false">
            <PatternLayout>
                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
            </PatternLayout>
            <TimeBasedTriggeringPolicy />
        </RollingFile>
        <Failover name="Failover" primary="RollingFile">
            <Failovers>
                <AppenderRef ref="Console"/>
            </Failovers>
        </Failover>
    </Appenders>
    <Loggers>
        <Root level="error">
            <AppenderRef ref="Failover"/>
        </Root>
    </Loggers>
</Configuration>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FailoverAppender is not starting

Remko Popma-2
Your root logger is referencing the Failover appender directly. It should reference the RollingFile appender instead.

Remko

(Shameless plug) Every java main() method deserves http://picocli.info

> On Jul 11, 2017, at 4:20, Vina Martin <[hidden email]> wrote:
>
> RollingFile

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FailoverAppender is not starting

Vina Martin
So instead of what I had, it should be configured like this?

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
        <RollingFile name="RollingFile" fileName="logs/app.log" filePattern="logs/app-%d{MM-dd-yyyy}.log.gz"
                     ignoreExceptions="false">
            <PatternLayout>
                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
            </PatternLayout>
            <TimeBasedTriggeringPolicy />
        </RollingFile>
        <Failover name="Failover" primary="RollingFile">
            <Failovers>
                <AppenderRef ref="Console"/>
            </Failovers>
        </Failover>
    </Appenders>
    <Loggers>
        <Root level="error">
            <AppenderRef ref="RollingFile"/>
        </Root>
    </Loggers>
</Configuration>


I am still seeing errors with this.

2017-07-10 16:43:17,201 main ERROR appender Failover has no parameter that matches element Failovers
2017-07-10 16:43:17,202 main ERROR Null object returned for RollingFile in Appenders.
2017-07-10 16:43:17,207 main ERROR Unable to locate appender "RollingFile" for logger config "root"
2017-07-10 16:43:17,208 main ERROR Unable to locate primary Appender RollingFile



I am using this as reference: https://logging.apache.org/log4j/2.0/manual/appenders.html#FailoverAppender



On 7/10/17, 3:58 PM, "Remko Popma" <[hidden email]> wrote:

>Your root logger is referencing the Failover appender directly. It should reference the RollingFile appender instead.
>
>Remko
>
>(Shameless plug) Every java main() method deserves http://picocli.info
>
>> On Jul 11, 2017, at 4:20, Vina Martin <[hidden email]> wrote:
>>
>> RollingFile
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FailoverAppender is not starting

Ralph Goers
In reply to this post by Remko Popma-2
I don’t think that is correct Remko. His configuration looked correct. But since he was getting a failure while the RollingFileAppender was initializing I think everything else failed.  The Failover appender had not finished its initialization because it essentially had no appenders to monitor (RollingFile returns null since it couldn’t create the Appender).

Ralph

> On Jul 10, 2017, at 3:58 PM, Remko Popma <[hidden email]> wrote:
>
> Your root logger is referencing the Failover appender directly. It should reference the RollingFile appender instead.
>
> Remko
>
> (Shameless plug) Every java main() method deserves http://picocli.info
>
>> On Jul 11, 2017, at 4:20, Vina Martin <[hidden email]> wrote:
>>
>> RollingFile
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FailoverAppender is not starting

Remko Popma-2
Sorry Martin, I was shooting from the hip. I should have checked the manual. Thanks for correcting me, Ralph.

(Shameless plug) Every java main() method deserves http://picocli.info

> On Jul 11, 2017, at 11:11, Ralph Goers <[hidden email]> wrote:
>
> I don’t think that is correct Remko. His configuration looked correct. But since he was getting a failure while the RollingFileAppender was initializing I think everything else failed.  The Failover appender had not finished its initialization because it essentially had no appenders to monitor (RollingFile returns null since it couldn’t create the Appender).
>
> Ralph
>
>> On Jul 10, 2017, at 3:58 PM, Remko Popma <[hidden email]> wrote:
>>
>> Your root logger is referencing the Failover appender directly. It should reference the RollingFile appender instead.
>>
>> Remko
>>
>> (Shameless plug) Every java main() method deserves http://picocli.info
>>
>>> On Jul 11, 2017, at 4:20, Vina Martin <[hidden email]> wrote:
>>>
>>> RollingFile
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...