gnodet-bot commented on code in PR #28113:
URL: https://github.com/apache/camel/pull/28113#discussion_r4315352707
##########
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:
💡 **Suggestion:** `System.setProperty` unconditionally overwrites any
`camel.jbang.logDir` the user or an embedder may have set before calling
`configureLog()`. Since `LOG_DIR` is a `public static final` constant (the
documented API for the log directory), callers have a reasonable expectation
that a pre-existing value is honoured.
A guard makes the intent explicit:
```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]