Hi Ralph,

We needed custom logger long long back when log4j1 logger was not sufficient to 
achieve the goal we had. We have multiple processes also using this logger.

For Appender, we actually needed rolling file appender, but the available 
appender in log4j1 didn’t work as expected with multiple proceess. So we wrote 
custom multi process rolling appender which actually extends FileAppender.

This whole code is legacy and old code. Due to time constraint we want to use 
bridge to migrate to log4j2 with bare minimum or very minor code changes to 
retain the functionality as is.

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Ralph Goers <ralph.go...@dslextreme.com>
Sent: Saturday, March 5, 2022 9:21:20 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 ***


I am still trying to understand why you have a custom Logger and a custom 
FileAppender. What additional features do they provide? Can you perhaps create 
a zip of your customizations so we can understand?

Thanks
Ralph

> On Mar 4, 2022, at 7:00 PM, Pooja Pandey <pooja.pan...@asg.com.INVALID> wrote:
>
> By overriding getAppender in our customLogger, the cast Exception could be 
> fixed, however we are still having some minor issues in reading property 
> value but may be this new issue is due to some other problems. I am still 
> trying to figure out.
>
>
>
>
>    @Override
>    public Appender getAppender(final String name) {
>        AppenderWrapper appenderWrapper = (AppenderWrapper) 
> super.getAppender(name);
>        return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();
>    }
>
>
> Get Outlook for iOS<https://aka.ms/o0ukef>
> ________________________________
> From: Pooja Pandey <pooja.pan...@asg.com.INVALID>
> Sent: Saturday, March 5, 2022 7:25:24 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 ***
>
>
> 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
>


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