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

The log4j2.messageFactory property is ignored since 2.23.0 #2379

Closed
ppkarwasz opened this issue Mar 14, 2024 · 7 comments · Fixed by #2505
Closed

The log4j2.messageFactory property is ignored since 2.23.0 #2379

ppkarwasz opened this issue Mar 14, 2024 · 7 comments · Fixed by #2505
Labels
bug Incorrect, unexpected, or unintended behavior of existing code
Milestone

Comments

@ppkarwasz
Copy link
Contributor

Description

Due to the changes in version 2.23.0, specifying an alternative default message factory through the log4j2.messageFactory
property does not work any more.

@ppkarwasz ppkarwasz added this to the 2.24.0 milestone Mar 14, 2024
@ppkarwasz ppkarwasz added the bug Incorrect, unexpected, or unintended behavior of existing code label Mar 14, 2024
@deepblueli
Copy link

deepblueli commented Apr 9, 2024

hi @ppkarwasz, the default message factory also changed from ReusableMessageFactory to ParameterizedMessageFactory when log4j2.enable.threadlocals is set to true.

Given that log4j2.messageFactory property doesn't work now, is there any other way we can change to use ReusableMessageFactory as the message factory?

@lizongbo
Copy link

This new code doesn't make the log4j2.messageFactory configuration work.Please roll back the logic that read the proeprties configuration file earlier.

@lizongbo
Copy link

My project with version log4j2 2.23.1 almost caused a serious problem

The following code is the correct implementation for the previous one


    public static final Class<? extends MessageFactory> DEFAULT_MESSAGE_FACTORY_CLASS = createClassForProperty(
            "log4j2.messageFactory", ReusableMessageFactory.class, ParameterizedMessageFactory.class);

@lizongbo
Copy link

@vy need open this Issue again.

@lizongbo
Copy link

this new code is not support for use log4j-slf4j-impl

log4j-slf4j-impl\src\main\java\org\apache\logging\slf4j\Log4jLogger.java
log4j-slf4j-impl Log4jLogger use src/main/java/org/apache/logging/log4j/simple/SimpleLogger.java
not use src/main/java/org/apache/logging/log4j/core/Logger.java

@ppkarwasz
Copy link
Contributor Author

@lizongbo,

Did you check the 2.24.0-SNAPSHOT? Volkan's patch is not contained in version 2.23.1.

@lizongbo
Copy link

@lizongbo,

Did you check the 2.24.0-SNAPSHOT? Volkan's patch is not contained in version 2.23.1.

Thank fo your reply, When I use 2.24.0-SNAPSHOT from https://repository.apache.org/content/groups/snapshots/
then I ound that wokrs ok,
I'll wait for 2.24.0 to be released as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect, unexpected, or unintended behavior of existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants