davsclaus commented on code in PR #27962:
URL: https://github.com/apache/camel/pull/27962#discussion_r4297493181


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java:
##########
@@ -50,84 +55,119 @@ public static void configureLog(
             String level, boolean color, boolean json, boolean script, boolean 
export, String loggingConfigPath,
             List<String> loggingCategories, boolean mcpStdio)
             throws Exception {
-        if (INIT_DONE.compareAndSet(false, true)) {
-            long pid = ProcessHandle.current().pid();
-            System.setProperty("pid", Long.toString(pid));
-            // make it possible to manage log4j via JMX and camel-cli
-            System.setProperty("log4j2.disable.jmx", "false");
-
-            if (loggingConfigPath != null) {
-                // ust custom logging configuration as-is
-                Configurator.initialize("CamelJBang", "file://" + 
Path.of(loggingConfigPath).toAbsolutePath());
-            } else if (mcpStdio) {
-                Configurator.initialize("CamelJBang", 
"log4j2-mcp-stdio.properties");
-            } else if (loggingCategories != null && 
!loggingCategories.isEmpty()) {
-                // enrich logging file with custom logging categories
-                String name = "log4j2-no-color.properties";
-                if (export) {
-                    name = "log4j2-export.properties";
-                } else if (script) {
-                    name = "log4j2-script.properties";
-                } else if (json) {
-                    name = "log4j2-json.properties";
-                } else if (color) {
-                    name = "log4j2.properties";
-                }
-                InputStream is = 
RuntimeUtil.class.getClassLoader().getResourceAsStream(name);
-                String content = IOHelper.loadText(is);
-                IOHelper.close(is);
-
-                StringJoiner sj = new StringJoiner(System.lineSeparator());
-                int i = 0;
-                for (String lc : loggingCategories) {
-                    String prefix = "custom" + i++;
-                    String catName = StringHelper.before(lc, "=", "").trim();
-                    String catLevel = StringHelper.after(lc, "=", "").trim();
-                    if ("root".equalsIgnoreCase(catName)) {
-                        // log4j allows one root logger only, which the 
template already defines: a root category is
-                        // the root logging level
-                        if (!catLevel.isEmpty()) {
-                            level = catLevel;
-                        }
-                        continue;
-                    }
-                    if (!catName.isEmpty() && !catLevel.isEmpty()) {
-                        sj.add("logger." + prefix + ".name=" + catName);
-                        sj.add("logger." + prefix + ".level=" + catLevel);
-                        // the category gets the same appenders as the root 
logger, so it must not also pass its
-                        // events up to the root, or every line is printed 
twice (CAMEL-24701)
-                        sj.add("logger." + prefix + ".additivity=false");
-                        if (!export && !script) {
-                            sj.add("logger." + prefix + 
".appenderRef.$1.ref=out");
-                        }
-                        sj.add("logger." + prefix + 
".appenderRef.$2.ref=file");
+        String location;
+        if (loggingConfigPath != null) {
+            // ust custom logging configuration as-is

Review Comment:
   Fixed in d114298ec97a, thanks.
   
   _Claude Code on behalf of davsclaus_



-- 
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]

Reply via email to