-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Description
A bad Log4j2 properties file will cause an exception to be thrown from PropertiesConfigurationBuilder, whereas previous versions would fall back to the default logging configuration. This is most likely to be encountered when a Log4j 1.2 properties file is named log4j2.properties or explicitly passed in using -Dlog4j.configurationFile instead of -Dlog4j.configuration, but it can also happen if the properties file is just plain malformed in a way that was tolerated in the past.
Configuration
Version: 2.25.0 and 2.25.1
Operating system: macOS Sequoia 15.5
JDK: Corretto 17.0.16 inter alia
Logs
[0] ~/src/logging-log4j2 # ./run.sh
Darwin 842f57b044d8 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041 arm64
Testing 2.24.3 with bad Log4j 1.2 properties config:
Testing 2.24.3 with bad Log4j 2.x properties config: 14:21:45.189 [main] ERROR org.example.App - error level message
Testing 2.24.3 with wrong properties config version: 14:21:45.742 [main] ERROR org.example.App - error level message
Testing 2.25.1 with bad Log4j 1.2 properties config:
Testing 2.25.1 with bad Log4j 2.x properties config: class org.apache.logging.log4j.core.config.ConfigurationException: No type attribute provided for component *
Testing 2.25.1 with wrong properties config version: class org.apache.logging.log4j.core.config.ConfigurationException: No type attribute provided for component log4j
Reproduction
Run ./run.sh:
https://github.com/rschmitt/logging-log4j2/tree/bad-config-eiie-repro
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done