openrewrite / rewrite-logging-frameworks

OpenRewrite recipes for assisting with Java logging migration tasks.
Apache License 2.0
26 stars 21 forks source link

Logging Configuration File Conversion Recipe #48

Open rdifrango opened 2 years ago

rdifrango commented 2 years ago

It would be great if there was a Recipe to convert between things like log4j.properties or log4j.xml to logback.xml etc.

aegershman commented 2 years ago

I agree, and I think this should be kept open. For the time being, it's not currently being prioritized. In the mean time, there are other products which can handle the migration from things like log4j.properties to log4j.xml:

(Granted, it means there's an additional step that has to be done, and it'd be better if the recipe handled these things as well-- but having those tools is better than nothing / doing everything by hand 🤷 )

rdifrango commented 2 years ago

The note on those converters as it only goes from log4j.properties to log4j.xml and not logback.xml . Now logback does have an online converter which can be found here:

https://logback.qos.ch/translator/

BTW, I totally respect it not being on the backlog.

ppkarwasz commented 11 months ago

There is an official Log4j1ConfigurationConverter in log4j-1.2-api that can be called from code.

It is less powerful than the new pluggable PropertiesConfigurationFactory used by log4j-1.2-api itself, but it should cover the log4j.properties configuration format and all the components in log4j:log4j.