[
https://issues.apache.org/jira/browse/CAMEL-24701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114680#comment-18114680
]
Claus Ibsen commented on CAMEL-24701:
-------------------------------------
Second finding on the same code path (run 7 of the benchmark):
logging.level.org.apache.camel=INFO in application.properties makes every log
line appear twice. RuntimeUtil.configureLog writes the category as
logger.customN with appenderRef out and file, the same appenders as the root
logger, and leaves additivity at its default (true), so the event is printed by
the category logger and again by the root. Fixed on the same local branch
(second commit): logger.customN.additivity=false.
> 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
> Priority: Minor
>
> 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)