-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Description
It appears that AbstractLogger.checkMessageFactory expects the default message factory to be ParameterizedMessageFactory (
logging-log4j2/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
Line 187 in c59fdd4
| } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) { |
logging-log4j2/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java
Line 114 in c79ae32
| private static MessageFactory getEffectiveMessageFactory(final MessageFactory messageFactory) { |
Configuration
Version: 2.24.0
Operating system: [OS and version]
JDK: 17
Logs
2025-02-12T10:31:17.559492800Z main WARN The Logger Log4JMessageFactoryWarning was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@32ee6fee and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
Reproduction
Log4j configuration should have status="info" enabled.
import org.apache.logging.log4j.LogManager;
public class Log4JMessageFactoryWarning {
public static void main(String[] args) {
LogManager.getLogger(Log4JMessageFactoryWarning.class);
LogManager.getLogger(Log4JMessageFactoryWarning.class);
}
}
Metadata
Metadata
Assignees
Labels
No labels