Ken Huang created KAFKA-21520:
---------------------------------

             Summary: Docker image overwrites a mounted log4j2.yaml when a 
Logger is written as a single map
                 Key: KAFKA-21520
                 URL: https://issues.apache.org/jira/browse/KAFKA-21520
             Project: Kafka
          Issue Type: Bug
            Reporter: Ken Huang
            Assignee: Ken Huang


When the Docker image prepares {{log4j2.yaml}} in 
{{{}KafkaDockerWrapper.prepareLog4j2Configs{}}}, it can silently overwrite a 
valid user-provided configuration with a minimal default configuration. This 
happens when {{Logger}} is defined as a single map rather than a list. Log4j2 
YAML supports both formats, and this issue occurs even when no environment 
variables are set.
h3. Steps to Reproduce

Mount the following {{log4j2.yaml}} and start the container without setting any 
{{KAFKA_LOG4J_*}} environment variables:

{{Configuration:
    Console:
      name: "STDOUT"
  Loggers:
    Root:
      level: "INFO"
      AppenderRef:
        ref: "STDOUT"
    Logger:
      name: "kafka"
      level: "WARN"}}

 

The configuration should be preserved as-is, with only the parts targeted by 
environment variables modified, if any. However, the final {{log4j2.yaml}} is 
silently replaced with {{{}Configuration: \{ Loggers: { Root: { level: "ERROR" 
} } }{}}}, causing all appenders and loggers to be lost and the root log level 
to change to {{{}ERROR{}}}. As a result, the broker produces almost no logs, 
without reporting any error or warning.

 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to