Score:1

Kafka stores log4j logs in directory literally called ${kafka.logs.dir}

cn flag

I installed a preview version of Kafka 3.0 with log4j2 support (http://home.apache.org/~dongjin/post/apache-kafka-log4j2-support/) on a RHEL 8 server. Kafka and Zookeeper are running successfully as systemd user services. I set the environment variable KAFKA_LOG4J_OPTS="-Dlog4j.configurationFile=file:/home/username/kafka/bin/../config/log4j2.properties" in the systemd unit file so that log4j 2.17 ist used.

However, there is one strange thing: all log4j logs are stored in a directory literally called ${kafka.logs.dir} in the home directory. The garbage collector successfully stores logs in the correct log location ~/kafka/logs. So the directory ~/kafka/logs contains files like kafkaServer-gc.log.0.current, while the hilariously strange directory ~/${kafka.logs.dir} contains server.log, controller.log, etc.

When looking at the processes for kafka and zookeeper, I can see that they both have the argument -Dkafka.logs.dir=/home/username/kafka/bin/../logs. Shouldn't this define the environment variable kafka.logs.dir, which is used in the file config/log4j2.properties? How come that Zookeeper and Kafka apparently don't have access to this $kafka.logs.dir environment variable?

jp flag
Result of disabled pattern substitution due to Log4shell fixes?
cn flag
You're probably right. I added a definition of kafka.logs.dir to the beginning of log4j2.properties with the directory path and it still used `${kafka.logs.dir}` as directory name.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.