kalayciburak opened a new pull request, #4353:
URL: https://github.com/apache/logging-log4j2/pull/4353
`Log4j1ConfigurationConverter` shares `Log4j1ConfigurationParser` with the
runtime factory. `getProperty` calls `OptionConverter.substVars`, which
resolves each `${...}` against the current JVM before the value is written. A
converted file therefore captures host system properties (`user.home`, paths,
anything set with `-D`) and loses the indirection.
The converter now rewrites variables instead of resolving them:
- a name defined in the properties file stays `${name}`, and its value is
emitted as a `<Property>` (nested system names inside that value become
`${sys:...}`)
- any other name becomes `${sys:name}`
`Log4j1ConfigurationFactory` still uses the default parser and resolves
variables.
Fixes #4348
## Checklist
* Base your changes on `2.x` branch if you are targeting Log4j 2; use `main`
otherwise
* Non-trivial changes contain an entry file in the `src/changelog/.2.x.x`
directory
* Tests are provided
`./mvnw verify` was not run.
## Tests
Executed with `JAVA_HOME` set to Java 17:
* `./mvnw -pl log4j-1.2-api -am
-Dtest=Log4j1ConfigurationConverterLookupTest
-Dsurefire.failIfNoSpecifiedTests=false test` — failed on current `2.x` because
`fileName` was `/root/logs/app.log`, then passed after the fix (3 tests, 0
failures)
* `./mvnw -pl log4j-1.2-api -am
-Dtest=Log4j1ConfigurationConverterLookupTest,Log4j1ConfigurationConverterHadoopTest,Log4j1ConfigurationConverterSparkTest,Log4j1ConfigurationFactoryTest
-Dsurefire.failIfNoSpecifiedTests=false test` — 70 tests, 0 failures
* `./mvnw -pl log4j-1.2-api spotless:apply` — clean
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]