[ 
https://issues.apache.org/jira/browse/CAMEL-24701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-24701.
---------------------------------
    Resolution: Fixed

> camel-jbang - logging.level.root in application.properties produces a second 
> log4j root logger and breaks the CLI log layout
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24701
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24701
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> camel run with an application.properties that contains
> {code}
> logging.level.root=WARN
> {code}
> prints at startup
> {noformat}
> main ERROR Unable to invoke factory method in class 
> org.apache.logging.log4j.core.config.LoggersPlugin for element Loggers: 
> java.lang.IllegalStateException: Configuration has multiple root loggers. 
> There can be only one.
> {noformat}
> and log4j falls back to its default configuration, so the Camel CLI log 
> layout (colors, the "el.impl.engine.AbstractCamelContext : Routes startup" 
> format, the log file) is lost for the whole run. The route itself starts. 
> Reproduced on 4.23.0-SNAPSHOT with a one-line timer route and only that 
> property.
> Cause: Run.configureLogging turns every logging.level.<name> key into a 
> logging category, and RuntimeUtil.configureLog writes each category as 
> logger.customN.name=<name> / logger.customN.level=<level>. For the name 
> "root" this adds a second root logger next to the rootLogger already defined 
> in the log4j2 template.
> logging.level.root is the Spring Boot spelling for the root level and is what 
> people (and LLMs) write by habit; quarkus.log.level would be the Quarkus 
> equivalent. Suggested fix: in configureLogging, treat root (and 
> quarkus.log.level) as the root level, that is set loggingOptions.loggingLevel 
> (unless --logging-level was given explicitly) instead of adding a category; a 
> test in camel-jbang-core for RuntimeUtil.configureLog with a "root=WARN" 
> category would catch the regression.
> Found on 2026-09-12 in the AI authoring benchmark: a local model wrote 
> logging.level.root=WARN into application.properties, which is a reasonable 
> thing to write.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to