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 <CAFmygFYAekmT=eDvfM1JnuibY0rnxYtwprRH7W8UwZHaFsJvOw@mail.gmail.com>
Hi Pooja,

On Fri, Mar 4, 2022 at 10:32 AM Pooja Pandey
<[email protected]> wrote:
> We are calling
> Logger.getLogger(<name>, <loggerFactory>)
>
> And in AppenderAttachableImpl aai;, this is returning  AppenderWrapper, which we are trying to cast to FileAppender as we were doing when we were using log4j1.x.

That will not work, since the Log4j 1.x bridge does not actually use
`org.apache.log4j.FileAppender`, but the Log4j 2.x version of this
appender.

Can you explain what is your code doing? Probably this can be more
easily obtained directly in Log4j 2.x.

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.