apache / apache/logging-log4j2
Log4j ignores system property configurationFile
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.7k
- Avg merge
- 21h 30m
- Merged PRs (30d)
- 27
Description
## Description
According to the [doumentation](https://logging.apache.org/log4j/3.x/manual/configuration.html), Log4j will inspect the `"log4j.configurationFile"` system property and, if set, will attempt to load the configuration using the `ConfigurationFactory` that matches the file extension. In version `2.x` this property was named `"log4j2.configurationFile"`. Either way, Log4j seems to ignore this system property. Instead it is sensitive to a system property named `"log4j2.*.Configuration.file"`.
Is this a documentation issue only? How should this be used in version `3.x`? Why case sensitive `Configuration`?
## Configuration
**Version:** 3.0.0-beta2
**Operating system:** 5.15.133.1-microsoft-standard-WSL2 #1 SMP x86_64 GNU/Linux
**JDK:** openjdk 17.0.9 2023-10-17
## Logs
In addition to above described issue, loading a YAML configuration works with version `3.0.0-beta1` but fails with `3.0.0-beta2`:
```
[Fatal Error] log4j2.yml:1:1: Content is not allowed in prolog.
ERROR StatusLogger Error parsing /config/log4j2.yml
org.xml.sax.SAXParseException; systemId: file:///config/log4j2.yml; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:262)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:342)
at org.apache.logging.log4j.core.config.xml.XmlConfiguration.(XmlConfiguration.java:88)
```
Apparently with the latest version a `XmlConfiguration` object is created even if the file extension is `yml`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.