From 5911fafe9969b34ca97c09f8a567b3e44784a679 Mon Sep 17 00:00:00 2001 From: Andy Coates <8012398+big-andy-coates@users.noreply.github.com> Date: Tue, 14 Jan 2020 12:52:52 +0000 Subject: [PATCH] fix: log4j properties files (#4293) * fix: log4j properties files This PR removes the log4j.properties files from our production jars. The presence of such files will make it more tricky for clients to correctly configure log4j with their own properties files as log4j picks the first it finds on the class path by default. Also, changed many log levels from `ERROR` to `WARN` as important warnings are being excluded, which could be hiding issues. --- config/log4j-rolling.properties | 28 +++++++++++++------ config/log4j.properties | 25 ++++++++++++----- .../src/main/resources/log4j.properties | 22 --------------- .../src/main/resources/log4j.properties | 22 --------------- 4 files changed, 38 insertions(+), 59 deletions(-) delete mode 100644 ksql-engine/src/main/resources/log4j.properties delete mode 100644 ksql-rest-app/src/main/resources/log4j.properties diff --git a/config/log4j-rolling.properties b/config/log4j-rolling.properties index 9bc1e0887122..5167f35433b9 100644 --- a/config/log4j-rolling.properties +++ b/config/log4j-rolling.properties @@ -46,22 +46,34 @@ log4j.appender.kafka_appender.BrokerList=localhost:9092 log4j.appender.kafka_appender.Topic=default_ksql_processing_log # loggers + +log4j.logger.org.reflections=ERROR, main + +# Uncomment the following line to stop KSQL from logging out each request it receives: +#log4j.logger.io.confluent.ksql.rest.server.resources.KsqlResource=WARN + +# And this one to avoid the logs being spammed with KsqlConfig values. +# Though these can be useful for debugging / investigations. +#log4j.logger.io.confluent.ksql.util.KsqlConfig=WARN + +## KSQL Processing logs: +log4j.logger.processing=WARN, kafka_appender +log4j.additivity.processing=false + +## Kafka Streams logs: log4j.logger.org.apache.kafka.streams=INFO, streams log4j.additivity.org.apache.kafka.streams=false -log4j.logger.kafka=ERROR, kafka +## Kafka client logs: +log4j.logger.kafka=WARN, kafka log4j.additivity.kafka=false -log4j.logger.org.apache.zookeeper=ERROR, kafka +log4j.logger.org.apache.zookeeper=WARN, kafka log4j.additivity.org.apache.zookeeper=false -log4j.logger.org.apache.kafka=ERROR, kafka +log4j.logger.org.apache.kafka=WARN, kafka log4j.additivity.org.apache.kafka=false -log4j.logger.org.I0Itec.zkclient=ERROR, kafka +log4j.logger.org.I0Itec.zkclient=WARN, kafka log4j.additivity.org.I0Itec.zkclient=false -log4j.logger.processing=ERROR, kafka_appender -log4j.additivity.processing=false - -log4j.logger.org.reflections=ERROR, main diff --git a/config/log4j.properties b/config/log4j.properties index 07a11c170b72..c1a9178c1fa3 100644 --- a/config/log4j.properties +++ b/config/log4j.properties @@ -15,6 +15,7 @@ log4j.rootLogger=INFO, stdout +# appenders log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n @@ -23,13 +24,23 @@ log4j.appender.streams=org.apache.log4j.ConsoleAppender log4j.appender.streams.layout=org.apache.log4j.PatternLayout log4j.appender.streams.layout.ConversionPattern=[%d] %p %m (%c:%L)%n -log4j.logger.kafka=ERROR, stdout -log4j.logger.org.apache.kafka.streams=INFO, streams -log4j.additivity.org.apache.kafka.streams=false -log4j.logger.org.apache.zookeeper=ERROR, stdout -log4j.logger.org.apache.kafka=ERROR, stdout -log4j.logger.org.I0Itec.zkclient=ERROR, stdout +# loggers + log4j.logger.org.reflections=ERROR, stdout # Uncomment the following line to stop KSQL from logging out each request it receives: -#log4j.logger.io.confluent.ksql.rest.server.resources.KsqlResource=WARN, stdout +#log4j.logger.io.confluent.ksql.rest.server.resources.KsqlResource=WARN + +# And this one to avoid the logs being spammed with KsqlConfig values. +# Though these can be useful for debugging / investigations. +#log4j.logger.io.confluent.ksql.util.KsqlConfig=WARN + +## Kafka Streams logs: +log4j.logger.org.apache.kafka.streams=INFO, streams +log4j.additivity.org.apache.kafka.streams=false + +## Kafka Client logs: +log4j.logger.kafka=WARN, stdout +log4j.logger.org.apache.zookeeper=WARN, stdout +log4j.logger.org.apache.kafka=WARN, stdout +log4j.logger.org.I0Itec.zkclient=WARN, stdout diff --git a/ksql-engine/src/main/resources/log4j.properties b/ksql-engine/src/main/resources/log4j.properties deleted file mode 100644 index eef0378911d1..000000000000 --- a/ksql-engine/src/main/resources/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2018 Confluent Inc. -# -# Licensed under the Confluent Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# http://www.confluent.io/confluent-community-license -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -log4j.rootLogger=WARN,stdout - -log4j.logger.io.confluent.ksql=INFO -log4j.logger.org.apache.kafka.clients.NetworkClient=ERROR -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n diff --git a/ksql-rest-app/src/main/resources/log4j.properties b/ksql-rest-app/src/main/resources/log4j.properties deleted file mode 100644 index eef0378911d1..000000000000 --- a/ksql-rest-app/src/main/resources/log4j.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2018 Confluent Inc. -# -# Licensed under the Confluent Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# http://www.confluent.io/confluent-community-license -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -log4j.rootLogger=WARN,stdout - -log4j.logger.io.confluent.ksql=INFO -log4j.logger.org.apache.kafka.clients.NetworkClient=ERROR -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n