Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Piotr P. Karwasz
Hi Pooja, On Sat, Mar 5, 2022 at 3:01 AM Pooja Pandey wrote: > @Override > public Appender getAppender(final String name) { > AppenderWrapper appenderWrapper = (AppenderWrapper) > super.getAppender(name); > return >

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Ralph Goers
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 wrote: > > By overriding

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Pooja Pandey
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

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Pooja Pandey
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

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Piotr P. Karwasz
On Fri, Mar 4, 2022 at 7:32 PM Ralph Goers 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

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Piotr P. Karwasz
Hi Pooja, On Fri, Mar 4, 2022 at 10:32 AM Pooja Pandey wrote: > We are calling > Logger.getLogger(, ) > > 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,

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Ralph Goers
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

Re: How to have ThreadContext be pre-populated?

2022-03-04 Thread Matt Sicker
That's the general purpose of the ContextDataProvider extension API. See https://logging.apache.org/log4j/2.x/manual/extending.html#ContextDataProvider for basic details. On Fri, Mar 4, 2022 at 8:31 AM Gary Gregory wrote: > > An example would help... > > Gary > > On Fri, Mar 4, 2022 at 8:52 AM

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Tushar Kapila
You might need to activate login debug and then should see the stack trace. Can search the web on ho to. On Fri, Mar 4, 2022, 21:00 Gary Gregory wrote: > Print copy and paste your stack trace in this email thread. > Then it will be clearer if it is simple for me to reproduce in a unit test > or

RE: Looking up a system property specified in a log4j v1 properties file

2022-03-04 Thread Natasha D'Silva
HI, I tried that and it worked. Thank you!

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Gary Gregory
Print copy and paste your stack trace in this email thread. Then it will be clearer if it is simple for me to reproduce in a unit test or if you need to provide one. Gary On Fri, Mar 4, 2022 at 4:32 AM Pooja Pandey wrote: > We are calling > Logger.getLogger(, ) > > And in

Re: How to have ThreadContext be pre-populated?

2022-03-04 Thread Gary Gregory
An example would help... Gary On Fri, Mar 4, 2022 at 8:52 AM Morten Sabroe Mortensen < morten.sabroe.morten...@gmail.com> wrote: > I miss a handler or a mechanism to have ThreadContext be pre-populated. > > Does anything exist which is called once per thread -- and without explicit > invocation

How to have ThreadContext be pre-populated?

2022-03-04 Thread Morten Sabroe Mortensen
I miss a handler or a mechanism to have ThreadContext be pre-populated. Does anything exist which is called once per thread -- and without explicit invocation by my program, of course -- ? The values I want to pre-populate with are non-trivial and need to be read by code; they are not constants.

RE: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Pooja Pandey
We are calling Logger.getLogger(, ) 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 Sent: Friday, March 4, 2022 2:48 PM To:

Re: java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Gary Gregory
What is the stack trace? Gary On Fri, Mar 4, 2022, 03:36 Pooja Pandey 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

2022-03-04 Thread Pooja Pandey
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

java.lang.ClassCastException: org.apache.log4j.bridge.AppenderWrapper cannot be cast to org.apache.log4j.FileAppender

2022-03-04 Thread Pooja Pandey
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