-2

I have an application using log4j 2.X library and I want to use custom appenders that are coded against log4j 1.X.

While rewriting the custom appenders using log4j 2.x is an obvious option, I want to understand if that's the only option.

The migration guide is not clear about whether custom appenders are backwards compatible or is there a standard way of porting/using them.

  • Useful link https://stackoverflow.com/questions/30019585/log4j2-why-would-you-use-it-over-log4j – Sambit Sep 14 '19 at 13:04
  • try it, would take less time. – Gaurav Jeswani Sep 14 '19 at 13:10
  • What do you mean by "appenders that are coded against log4j"? Are you saying you have custom appenders that were written for log4j v1.x or are you simply wanting to use the same log4j configuration file that was used for log4j1.x? Lastly, have you read the [log4j 1.x migration page](https://logging.apache.org/log4j/2.x/manual/migration.html)? – D.B. Sep 14 '19 at 18:50
  • @D.B. It's exactly what it means. I have custom appenders that were written for 1.X. I simply wanted to understand if they are backwards compatible before I rewrite them using 2.X apis. And yes, I did read the migration page and I was not able to find any mentions of appenders being 'not backwards compatible'. I wanted to understand if there is a 'standard' way of porting them using any adapter libs for eg. I am making the question more explicit. – user1512141 Sep 15 '19 at 14:04

1 Answers1

1

I simply wanted to understand if they are backwards compatible before I rewrite them using 2.X apis.

They are not backwards compatible. For example:

  • The package name for the Appender interface is different
  • Many of the methods in the Appender interface are different.

You can tell this by comparing the respective Log4j javadocs for 1.2.x and 2.x.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216