chia7712 commented on code in PR #18394: URL: https://github.com/apache/kafka/pull/18394#discussion_r1959192770
########## core/src/main/scala/kafka/docker/KafkaDockerWrapper.scala: ########## @@ -219,6 +231,68 @@ object KafkaDockerWrapper extends Logging { Files.write(filepath, properties.getBytes(StandardCharsets.UTF_8), mode) } + private def addToYaml(loggerFromEnv: Array[Logger], rootOption: Option[Root], filepath: Path): Unit = { + val path = filepath + if (!Files.exists(path)) { + Files.createFile(path) + } + + val mapper = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER)) + .configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true) + .setSerializationInclusion(JsonInclude.Include.NON_EMPTY) + .findAndRegisterModules(); + + val yaml = try { + mapper.readValue(filepath.toFile, classOf[Log4jConfiguration]) + } catch { + case _: MismatchedInputException => new Log4jConfiguration + case e: RuntimeException => throw e + } + val config = yaml.getConfiguration + + if (config == null && loggerFromEnv.isEmpty && rootOption.isEmpty) { Review Comment: we should remove this condition. otherwise, the script used by docker can't see the output log4j2 config ... -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org