Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MS29] Automatic migration tools #2 #3220

Closed
1 task done
ppkarwasz opened this issue Nov 19, 2024 · 1 comment
Closed
1 task done

[MS29] Automatic migration tools #2 #3220

ppkarwasz opened this issue Nov 19, 2024 · 1 comment
Labels
STF-Milestones Milestones funded by the Sovereign Tech Fund

Comments

@ppkarwasz
Copy link
Contributor

ppkarwasz commented Nov 19, 2024

This task is the continuation of #2080 and will provide:

  • additional supported configuration file formats and tools,

See #2080 for a global description of the task.

@ppkarwasz ppkarwasz added the STF-Milestones Milestones funded by the Sovereign Tech Fund label Nov 19, 2024
ppkarwasz added a commit to apache/logging-log4j-transform that referenced this issue Nov 26, 2024
This adds support for Log4j 1 configuration formats.
Since Log4j Core 2 is a complete rewrite for Log4j 1, the converter:

- Needs to know exactly what configuration parameters a Log4j 1 component supports to create an equivalent Log4j Core 2 configuration.
- Introduces a pluggable `spi/v1/Log4j1ComponentParser` interface.
  For each supported Log4j 1 component, an implementation of this interface must be provided and registered with `ServiceLoader`.

The following Log4j 1 components are currently supported:

- Appenders: `ConsoleAppender`, `DailyRollingFileAppender`, `FileAppender` and `RollingFileAppender`.
- Filters: `DenyAllFilter`, `LevelMatchFilter`, `LevelRangeFilter` and `StringMatchFilter`.
- Layouts: `HTMLLayout`, `PatternLayout`, `SimpleLayout`, `TTCCLayout`.

Part of apache/logging-log4j2#3220
ppkarwasz added a commit to apache/logging-log4j-transform that referenced this issue Nov 26, 2024
This adds support for Log4j 1 configuration formats.
Since Log4j Core 2 is a complete rewrite for Log4j 1, the converter:

- Needs to know exactly what configuration parameters a Log4j 1 component supports to create an equivalent Log4j Core 2 configuration.
- Introduces a pluggable `spi/v1/Log4j1ComponentParser` interface.
  For each supported Log4j 1 component, an implementation of this interface must be provided and registered with `ServiceLoader`.

The following Log4j 1 components are currently supported:

- Appenders: `ConsoleAppender`, `DailyRollingFileAppender`, `FileAppender` and `RollingFileAppender`.
- Filters: `DenyAllFilter`, `LevelMatchFilter`, `LevelRangeFilter` and `StringMatchFilter`.
- Layouts: `HTMLLayout`, `PatternLayout`, `SimpleLayout`, `TTCCLayout`.

Part of apache/logging-log4j2#3220
ppkarwasz added a commit to apache/logging-log4j-transform that referenced this issue Nov 27, 2024
This adds support for Log4j 1 configuration formats to the Configuration Converter API
Since Log4j Core 2 is a complete rewrite for Log4j 1, the converter:

- Needs to know exactly what configuration parameters a Log4j 1 component supports to create an equivalent Log4j Core 2 configuration.
- Introduces a pluggable `spi/v1/Log4j1ComponentParser` interface.
  For each supported Log4j 1 component, an implementation of this interface must be provided and registered with `ServiceLoader`.

The following Log4j 1 components are currently supported:

- Appenders: `ConsoleAppender`, `DailyRollingFileAppender`, `FileAppender` and `RollingFileAppender`.
- Filters: `DenyAllFilter`, `LevelMatchFilter`, `LevelRangeFilter` and `StringMatchFilter`.
- Layouts: `HTMLLayout`, `PatternLayout`, `SimpleLayout`, `TTCCLayout`.

Part of apache/logging-log4j2#3220
ppkarwasz added a commit to apache/logging-log4j-transform that referenced this issue Dec 5, 2024
This PR adds a simple `picocli`-based tool to access the Configuration Converter API from the command line.
Currently, two commands are available:

- `configFile listFormats` lists the available configuration file formats.
- `configFile convert` converts configuration files from one format to another (e.g., a Log4j 1 Properties file to a Log4j 2 Core XML file).

Part of apache/logging-log4j2#3220
ppkarwasz added a commit to apache/logging-log4j-transform that referenced this issue Dec 15, 2024
This PR adds a simple `picocli`-based tool to access the Configuration Converter API from the command line.
Currently, two commands are available:

- `configFile listFormats` lists the available configuration file formats.
- `configFile convert` converts configuration files from one format to another (e.g., a Log4j 1 Properties file to a Log4j 2 Core XML file).

Part of apache/logging-log4j2#3220
ppkarwasz added a commit to ppkarwasz/rewrite-logging-frameworks that referenced this issue Dec 18, 2024
This PR uses the [Log4j Configuration Converter API](https://logging.staged.apache.org/log4j/transform/log4j-converter-config.html) to add a
`Log4j1ConfigurationToLog4jCore2` rule, which converts `log4j.properties` and `log4j.xml` configuration files into the equivalent `log4j2.xml` configuration files.

It also refactors the `Log4j1toLog4j2` recipe into three parts:

- `Log4j1toLog4jAPI` performs the migration from the "Log4j 1 API" to Log4j API 2,
as described in [Log4j 1 API migration](https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#api-migration). This recipe performs almost exclusively Java code changes and is usually not required in applications that use JCL or SLF4J as logging interface.
- `Log4j1ConfigurationToLog4jCore2` migrates configuration files, as described in the [Log4j 1 Configuration file migration](https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#configuration-file-migration) section.
- `Log4j1ToLog4jCore2` migrates the runtime dependencies to use Log4j Core 2 instead of Log4j 1, as described in [Log4j 1 Backend migration](https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#backend-migration) and also calls the previous recipe. This is probably the most useful recipe for users that no longer user Log4j 1 directly, but use it as logging implementation.

Closes openrewrite#154.
Related to apache/logging-log4j2#3220
@grobmeier
Copy link
Member

looks good, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STF-Milestones Milestones funded by the Sovereign Tech Fund
Projects
None yet
Development

No branches or pull requests

2 participants