Actually, in first go due to time constraint, we are using log4j bridge instead 
of direct log4j2 API to migrate our legacy huge code from log4j1 to log4j2.

In code we use custom FileAppender

When we Logger.getAppender(), it is returning AppenderWrapper now with the 
bridge.

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Piotr P. Karwasz <piotr.karw...@gmail.com>
Sent: Saturday, March 5, 2022 12:15:55 AM
To: Log4J Users List <log4j-user@logging.apache.org>
Subject: Re: java.lang.ClassCastException: 
org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
org.apache.log4j.FileAppender

*** External email: Verify sender before opening attachments or links ***


On Fri, Mar 4, 2022 at 7:32 PM Ralph Goers <ralph.go...@dslextreme.com> wrote:
> I am a little surprised though as it looks like Gary added the Log4j 1.2 
> FileAppender to log4j-1.2-api but he didn’t remove the builder. If he had it 
> would have created org.apache.log4j.FileAppender as you want.

The `org.apache.log4j.FileAppender` class is useful to inherit from
it. I have successfully tested the `RollingFileAppender` from Apache
Log4j Extras as native Log4j 1.x appender (there is no builder for
this one) running through the bridge.

I don't believe we actually want to use
`org.apache.log4j.FileAppender` instead of
`org.apache.logging.log4j.core.appender.FileAppender`. I suppose that
the latter gives a better performance.

Piotr

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to