Piotr,

Even if getAppender() were to bypass the AppenderWrapper it would still return 
org.apache.logging.log4j.core.appender.FileAppender, not 
org.apache.log4j.FileAppender. 
Are you proposing that getAppender return a proxy for 
org.apache.log4j.FileAppender?

Ralph

> On Mar 5, 2022, at 6:53 AM, Piotr P. Karwasz <piotr.karw...@gmail.com> wrote:
> 
> Hi Pooja,
> 
> On Sat, Mar 5, 2022 at 1:48 PM Pooja Pandey
> <pooja.pan...@asg.com.invalid> wrote:
>> Hi Piotr,
>> 
>> I don’t understand what is the bug?? Can you please help me with JIRA
>> ticket summary and description.
> 
> The bug is that if you use a native Log4j 1.2 appender (a derivative
> class of org.apache.log4j.FileAppender for example) a call to
> `Logger.getAppender(String)` gives you an AppenderWrapper of an
> AppenderAdapter instead of the original class. Such useless
> encapsulations should not be present, but apparently we missed some.
> Summarizing "Log4j 1.x bridge Logger.getAppender returns a wrapped
> AppenderAdapter"
> In the Jira ticket just describe your exact situation: are you using a
> configuration file or are you adding the appenders in code? Are you
> always using a LoggerFactory?
> My wild guess is that you configure a subclass of
> org.apache.log4j.FileAppender (let's call it com.example.FileAppender)
> in a configuration file. In your code you call `Logger.getAppender()`
> and you get an AppenderWrapper instead of com.example.FileAppender. If
> the guess is true, it is an easy fix.
> 
> 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