Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

"Piotr P. Karwasz" <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFYnd=33vNPmSFzMVxZqoUy57hNwCaq28kP6D0xg-0jY0A@mail.gmail.com>
On Sat, Mar 5, 2022 at 10:50 PM Gary Gregory <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.