At this point this would be expected. We don’t actually have 
org.apache.log4j.FileAppender in log4j-1.2-api. We map it to 
org.apache.logging.log4j.core.appender.FileAppender.

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.

That said, may I ask why you need access to the FileAppender? I’m just 
wondering if Log4j 2 already has what you are looking for implemented.

Ralph

> On Mar 4, 2022, at 2:32 AM, Pooja Pandey <pooja.pan...@asg.com.INVALID> 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.
> 
> -----Original Message-----
> From: Gary Gregory <garydgreg...@gmail.com> 
> Sent: Friday, March 4, 2022 2:48 PM
> To: pooja.pan...@asg.com.invalid
> Cc: 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 ***
> 
> 
> What is the stack trace?
> 
> Gary
> 
> On Fri, Mar 4, 2022, 03:36 Pooja Pandey <pooja.pan...@asg.com.invalid>
> wrote:
> 
>> Hi Team,
>> 
>> 
>> 
>> I am trying to migrate from log4j1.x to log4j2.17.2 using log4j1.x 
>> bridge approach. I am getting below ClassCastException error message. 
>> Please let me know if you have any idea how to fix this.
>> 
>> 
>> 
>> java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper
>> cannot be cast to org.apache.log4j.FileAppender
>> 
>> 
>> 
>> Thanks,
>> 
>> Pooja
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 


---------------------------------------------------------------------
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