Skip to content

Conversation

@ppkarwasz
Copy link
Contributor

This moves the converter between log4j.properties and log4j2.xml from log4j-1.2-api to a new log4j-config-converter artifact.

rgoers and others added 30 commits April 1, 2024 12:43
Partial support for XML and HTML layouts (defaults only).
Partial support for TTCC layout (defaults only).
Partial support for EnhancedPatternLayout (defaults only).
The Core AbstractConfiguration should track its LoggerContext.
carterkozak and others added 20 commits April 1, 2024 12:43
…s (#737)

* Fixes default Log4j 1.x values

The properties of the generated appenders are not always the same as it
was in Log4j 1.x.

* Fixes NoSuchFieldError

Adapts `getAppendProperty` to different Java versions.

* Fixes whitespace problems

Conflicts:
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/ConsoleAppenderBuilder.java
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/DailyRollingFileAppenderBuilder.java
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/FileAppenderBuilder.java
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/RollingFileAppenderBuilder.java
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/layout/HtmlLayoutBuilder.java
	log4j-1.2-api/src/test/java/org/apache/log4j/config/PropertiesConfigurationTest.java
Tests are from PR #762 by ppkarwasz.

Conflicts:
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/BuilderManager.java
	log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
	log4j-1.2-api/src/test/java/org/apache/log4j/config/PropertiesConfigurationTest.java
The `log4j.threshold` configuration key was not translated into its
Log4j 2.x equivalent global filter.

Conflicts:
	log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
Synchronizes `log4j-1.2-api` main source with version 2.17.2. It mainly
consists of:

* formatting,
* `final` modifiers,
* the removal of the deprecated `Holder` class.
When custom levels are in play the names of Log4j 1.x custom levels
(which are not unique) and those of Log4j 2.x custom levels (which must
be unique) do not match.

There is a need therefore for a pattern converter specific to Log4j 1.x.

Conflicts:
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/layout/PatternLayoutBuilder.java
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/layout/SimpleLayoutBuilder.java
Although `%pid` was never a valid Log4j 1.x pattern, it was supported in
the previous bridge versions.

This fixes a regression with respect to `log4j-1.2-api` version 2.17.2.

Conflicts:
	log4j-1.2-api/src/main/java/org/apache/log4j/builders/layout/PatternLayoutBuilder.java
- Moved Plugin::category into recently created annotation Category::value
- Category is no longer a qualifier type but instead a namespace for Key.
- Allow for stereotype annotations for Category to make categories annotation-type-safe when desired (including new TypeConverterCategory stereotype)
- Rename Plugin::name to Plugin::value and make it optional, defaulting to the simple class name of the annotated class
- Add PluginEntry::getElementName to more consistently store element names along with refactoring to use a builder pattern
- Fix PluginElementVisitor to fall back to checking a plugin name when the element name isn't defined. This inconsistency arose from a typo somewhere.
- Update PluginOrder to fall back to comparing by class name when neither class is annotated
- Replace Named with Category when injecting plugin categories
- Update docs to clarify that plugin categories are namespaces

Signed-off-by: Matt Sicker <[email protected]>
This commit ensures that:

* an `InstanceFactory` is created in the Log4j `Provider`,
* the same factory is injected as parameters to all
  the components of the chain `Log4jContextFactory`, `ContextSelector`,
  `LoggerContext` (child), `Configuration` (grand-child).
* `DI.createInstanceFactory` is called only when strictly necessary.
ppkarwasz added a commit to apache/logging-log4j2 that referenced this pull request Apr 1, 2024
We remove the command line tools to generate logger wrappers and convert
Log4j 1.x configuration.

The tools have been submitted to Log4j Transform:

 * apache/logging-log4j-transform#92
 * apache/logging-log4j-transform#93

and are not necessary at runtime.

The `Log4j1ConfigurationFactory` that has been removed from
`log4j-1.2-api` is an **older** and deprecated version of the
`PropertiesConfigurationFactory`.
ppkarwasz added a commit to apache/logging-log4j2 that referenced this pull request Apr 1, 2024
We remove the command line tools to generate logger wrappers and convert
Log4j 1.x configuration.

The tools have been submitted to Log4j Transform:

 * apache/logging-log4j-transform#92
 * apache/logging-log4j-transform#93

and are not necessary at runtime.

The `Log4j1ConfigurationFactory` that has been removed from
`log4j-1.2-api` is an **older** and deprecated version of the
`PropertiesConfigurationFactory`.
ppkarwasz added a commit to apache/logging-log4j2 that referenced this pull request Apr 1, 2024
We remove the command line tools to generate logger wrappers and convert
Log4j 1.x configuration.

The tools have been submitted to Log4j Transform:

 * apache/logging-log4j-transform#92
 * apache/logging-log4j-transform#93

and are not necessary at runtime.

The `Log4j1ConfigurationFactory` that has been removed from
`log4j-1.2-api` is an **older** and deprecated version of the
`PropertiesConfigurationFactory`.
ppkarwasz added a commit to apache/logging-log4j2 that referenced this pull request Apr 3, 2024
We remove the command line tools to generate logger wrappers and convert
Log4j 1.x configuration.

The tools have been submitted to Log4j Transform:

 * apache/logging-log4j-transform#92
 * apache/logging-log4j-transform#93

and are not necessary at runtime.

The `Log4j1ConfigurationFactory` that has been removed from
`log4j-1.2-api` is an **older** and deprecated version of the
`PropertiesConfigurationFactory`.
ppkarwasz added a commit to apache/logging-log4j2 that referenced this pull request Apr 4, 2024
We remove the command line tools to generate logger wrappers and convert
Log4j 1.x configuration.

The tools have been submitted to Log4j Transform:

 * apache/logging-log4j-transform#92
 * apache/logging-log4j-transform#93

and are not necessary at runtime.

The `Log4j1ConfigurationFactory` that has been removed from
`log4j-1.2-api` is an **older** and deprecated version of the
`PropertiesConfigurationFactory`.
@ppkarwasz
Copy link
Contributor Author

Closing this, since #145 makes it obsolete.

@ppkarwasz ppkarwasz closed this Nov 26, 2024
@ppkarwasz ppkarwasz deleted the feature/log4j-config-converter branch November 26, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants