gnodet-bot commented on code in PR #28113:
URL: https://github.com/apache/camel/pull/28113#discussion_r4313921499
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java:
##########
@@ -117,12 +130,14 @@ public static void configureLog(
} else if (json) {
location = "log4j2-json.properties";
} else if (color) {
- location = "log4j2.properties";
+ location = COLOR_CONFIG;
} else {
location = "log4j2-no-color.properties";
}
synchronized (RuntimeUtil.class) {
+ // log4j resolves the name of a log file when it loads the
configuration
+ System.setProperty(LOG_DIR,
CommandLineHelper.getCamelDir().toString());
Review Comment:
⚠️ **Unconditional overwrite of user-supplied property.**
`System.setProperty(LOG_DIR, ...)` silently replaces any value the user passed
via `-Dcamel.jbang.logDir`. Use the three-argument pattern to preserve
user-supplied values:
```suggestion
System.setProperty(LOG_DIR,
System.getProperty(LOG_DIR,
CommandLineHelper.getCamelDir().toString()));
```
--
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]