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

-----Original Message-----
From: Ralph Goers <ralph.go...@dslextreme.com> 
Sent: Thursday, March 3, 2022 10:44 AM
To: Log4J Users List <log4j-user@logging.apache.org>
Subject: Re: Programmatic configuration all or nothing?

*** External email: Verify sender before opening attachments or links ***


As its name implies, ConfigurationBuilder creates a new Configuration. Any 
Configuration you build this way would replace an existing Configuration.

I’d like to understand your use case for wanting Programmatic configuration. If 
you need to do that either we need to implement some feature so you don’t have 
to or you aren’t aware that you already don’t.

To be clear, with Log4j 2 you wouldn’t be creating Loggers, you would be 
creating LoggerConfigs and attaching appenders to them. Yes, this can be done 
programmatically but we generally try to discourage it.

Ralph

> On Mar 2, 2022, at 3:55 PM, Robert Nicholson <robert.nichol...@gmail.com> 
> wrote:
>
> When using ConfigurationBuilder is it all or nothing or can you integrate 
> what your builder builds into the existing log4j that’s already been 
> initialized from log4j.xml. Actually I’ve already initialized using my xml 
> “manually” using setConfigLocation earlier.
>
> With 1.x you can get a reference an existing logger (already defined by 
> log4j.xml) and then attach appenders to it.
>
> That’s what I ideally want to do with ConfigurationBuilder so that I can 
> still statically setup other loggers that don’t need to be dynamically 
> created.
>
>
> ---------------------------------------------------------------------
> 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