Hi Piotr,

I am not building log4j2 1.x bridge jars but downloading the jar directly. I 
wanted to test with your Pull Request changes, is it possible for you to 
provide log4j1.x bridge.jar log4j2-core.jar and log4j2-api.jar built with this 
change ??

-----Original Message-----
From: Piotr P. Karwasz <piotr.karw...@gmail.com> 
Sent: Sunday, March 6, 2022 2:38 PM
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 Sat, Mar 5, 2022 at 10:50 PM Gary Gregory <garydgreg...@gmail.com> wrote:
> This is a bit tricky, the API is typed to return an Appender and 
> that's what we do, not only that but it is an Appender that behaves properly 
> IIRC.
> If we returned the wrapped Log4j 1 Appender and you call it, the wrong 
> thing will happen IIRC.

The only problem I see in unwrapping an `AppenderAdapter` is in the case 
filters are configured. Since `AppenderSkeleton` does not perform filtering, 
this would cause the returned appender to behave incorrectly. If no filters are 
configured (including the one created from the `Threshold` property), we can 
unwrap the `AppenderAdapter` safely.

Can you have a look at:

https://github.com/apache/logging-log4j2/pull/786

If  this solves Pooja's problem, I can merge it.

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