diff --git a/avro-serializer/src/test/resources/log4j2.xml b/avro-serializer/src/test/resources/log4j2.xml deleted file mode 100644 index 6bc08c56e3d..00000000000 --- a/avro-serializer/src/test/resources/log4j2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/avro-serializer/src/test/resources/log4j2.yaml b/avro-serializer/src/test/resources/log4j2.yaml new file mode 100644 index 00000000000..30c6789e18f --- /dev/null +++ b/avro-serializer/src/test/resources/log4j2.yaml @@ -0,0 +1,13 @@ +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: stdout diff --git a/benchmark/src/main/resources/log4j2.xml b/benchmark/src/main/resources/log4j2.xml deleted file mode 100644 index 02ebe1358c5..00000000000 --- a/benchmark/src/main/resources/log4j2.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/benchmark/src/main/resources/log4j2.yaml b/benchmark/src/main/resources/log4j2.yaml new file mode 100644 index 00000000000..4ac886b82c6 --- /dev/null +++ b/benchmark/src/main/resources/log4j2.yaml @@ -0,0 +1,84 @@ +# Copyright 2025 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. + +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: stdout + Logger: + # Disable INFO logs from Config classes, which log out their config on each creation + - name: org.apache.kafka.streams.StreamsConfig + level: WARN + - name: io.confluent.kafka.serializers.protobuf.KafkaProtobufSerializerConfig + level: WARN + - name: org.apache.kafka.clients.consumer.ConsumerConfig + level: WARN + - name: org.apache.kafka.clients.admin.AdminClientConfig + level: WARN + - name: io.confluent.connect.protobuf.ProtobufDataConfig + level: WARN + - name: io.confluent.kafka.serializers.KafkaJsonDeserializerConfig + level: WARN + - name: io.confluent.kafka.serializers.json.KafkaJsonSchemaDeserializerConfig + level: WARN + - name: kafka.server.KafkaConfig + level: WARN + - name: org.apache.kafka.connect.json.JsonConverterConfig + level: WARN + - name: io.confluent.connect.protobuf.ProtobufConverterConfig + level: WARN + - name: io.confluent.connect.json.JsonSchemaConverterConfig + level: WARN + - name: io.confluent.kafka.serializers.KafkaAvroSerializerConfig + level: WARN + - name: io.confluent.kafka.serializers.protobuf.KafkaProtobufDeserializerConfig + level: WARN + - name: org.apache.kafka.clients.producer.ProducerConfig + level: WARN + - name: io.confluent.connect.avro.AvroConverterConfig + level: WARN + - name: io.confluent.kafka.serializers.KafkaAvroDeserializerConfig + level: WARN + - name: io.confluent.kafka.serializers.json.KafkaJsonSchemaSerializerConfig + level: WARN + - name: io.confluent.connect.json.JsonSchemaDataConfig + level: WARN + - name: io.confluent.connect.avro.AvroDataConfig + level: WARN + - name: io.confluent.kafka.serializers.KafkaJsonSerializerConfig + level: WARN + + # Disable logging of state transitions in KS + - name: org.apache.kafka.streams.KafkaStreams + level: WARN + - name: org.apache.kafka.streams.processor.internals.StreamThread + level: WARN + - name: org.apache.kafka.streams.state.internals.RocksDBTimestampedStore + level: WARN + + # Disable logging of App info + - name: org.apache.kafka.common.utils.AppInfoParser + level: WARN + + # Disable logging from reflections warning for connect classpath scans + - name: org.reflections + level: ERROR diff --git a/bin/schema-registry-run-class b/bin/schema-registry-run-class index 8a33efe3559..4daba4e93a4 100755 --- a/bin/schema-registry-run-class +++ b/bin/schema-registry-run-class @@ -54,12 +54,12 @@ fi if [ -z "$SCHEMA_REGISTRY_LOG4J_OPTS" ]; then # Test for files from dev -> packages so this will work as expected in dev if you have packages # installed - if [ -e "$base_dir/config/log4j2.xml" ]; then # Dev environment - LOG4J_DIR="$base_dir/config/log4j2.xml" - elif [ -e "$base_dir/etc/schema-registry/log4j2.xml" ]; then # Simple zip file layout - LOG4J_DIR="$base_dir/etc/schema-registry/log4j2.xml" - elif [ -e "/etc/schema-registry/log4j2.xml" ]; then # Normal install layout - LOG4J_DIR="/etc/schema-registry/log4j2.xml" + if [ -e "$base_dir/config/log4j2.yaml" ]; then # Dev environment + LOG4J_DIR="$base_dir/config/log4j2.yaml" + elif [ -e "$base_dir/etc/schema-registry/log4j2.yaml" ]; then # Simple zip file layout + LOG4J_DIR="$base_dir/etc/schema-registry/log4j2.yaml" + elif [ -e "/etc/schema-registry/log4j2.yaml" ]; then # Normal install layout + LOG4J_DIR="/etc/schema-registry/log4j2.yaml" fi # If Cygwin is detected, LOG4J_DIR is converted to Windows format. diff --git a/bin/windows/schema-registry-run-class.bat b/bin/windows/schema-registry-run-class.bat index b91eff92bc7..52fd91c1d80 100644 --- a/bin/windows/schema-registry-run-class.bat +++ b/bin/windows/schema-registry-run-class.bat @@ -31,10 +31,10 @@ for %%i in (confluent-common, rest-utils, schema-registry) do ( rem Log4j settings IF ["%SCHEMA_REGISTRY_LOG4J_OPTS%"] EQU [""] ( - if exist %~dp0../../etc/schema-registry/log4j2.xml ( - set SCHEMA_REGISTRY_LOG4J_OPTS=-Dlog4j2.configurationFile=%~dp0../../etc/schema-registry/log4j2.xml + if exist %~dp0../../etc/schema-registry/log4j2.yaml ( + set SCHEMA_REGISTRY_LOG4J_OPTS=-Dlog4j2.configurationFile=%~dp0../../etc/schema-registry/log4j2.yaml ) else ( - set SCHEMA_REGISTRY_LOG4J_OPTS=-Dlog4j2.configurationFile=%BASE_DIR%/config/log4j2.xml + set SCHEMA_REGISTRY_LOG4J_OPTS=-Dlog4j2.configurationFile=%BASE_DIR%/config/log4j2.yaml ) ) diff --git a/config/log4j2.xml b/config/log4j2.xml deleted file mode 100644 index 7a9087f1f24..00000000000 --- a/config/log4j2.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/config/log4j2.yaml b/config/log4j2.yaml new file mode 100644 index 00000000000..cbf9b891f45 --- /dev/null +++ b/config/log4j2.yaml @@ -0,0 +1,39 @@ +Configuration: + name: Log4j2 + Appenders: + RollingFile: + name: file + fileName: "${sys:schema-registry.log.dir}/schema-registry.log" + filePattern: "${sys:schema-registry.log.dir}/schema-registry.log.%i" + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Policies: + SizeBasedTriggeringPolicy: + size: 100MB + DefaultRolloverStrategy: + max: 10 + fileIndex: min + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: file + - ref: stdout + Logger: + - name: org.apache.zookeeper + level: ERROR + AppenderRef: + - ref: stdout + - name: kafka + level: ERROR + AppenderRef: + - ref: stdout + - name: org.apache.kafka + level: ERROR + AppenderRef: + - ref: stdout diff --git a/core/src/main/resources/log4j2.xml b/core/src/main/resources/log4j2.xml deleted file mode 100644 index b9a9c173a1f..00000000000 --- a/core/src/main/resources/log4j2.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/src/main/resources/log4j2.yaml b/core/src/main/resources/log4j2.yaml new file mode 100644 index 00000000000..98e0751fd0e --- /dev/null +++ b/core/src/main/resources/log4j2.yaml @@ -0,0 +1,30 @@ +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: stdout + Logger: + - name: org.apache.kafka + level: ERROR + AppenderRef: + - ref: stdout + - name: org.apache.zookeeper + level: ERROR + AppenderRef: + - ref: stdout + - name: org.apache.directory + level: ERROR + AppenderRef: + - ref: stdout + - name: kafka + level: ERROR + AppenderRef: + - ref: stdout diff --git a/core/src/test/resources/log4j2.xml b/core/src/test/resources/log4j2.xml deleted file mode 100644 index 53779a284e6..00000000000 --- a/core/src/test/resources/log4j2.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/src/test/resources/log4j2.yaml b/core/src/test/resources/log4j2.yaml new file mode 100644 index 00000000000..b8485b267cd --- /dev/null +++ b/core/src/test/resources/log4j2.yaml @@ -0,0 +1,47 @@ +# Copyright 2025 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. + +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: stdout + Logger: + - name: org.apache.kafka + level: ERROR + AppenderRef: + - ref: stdout + - name: org.apache.zookeeper + level: ERROR + AppenderRef: + - ref: stdout + - name: io.confluent + level: DEBUG + AppenderRef: + - ref: stdout + - name: org.apache.directory + level: ERROR + AppenderRef: + - ref: stdout + - name: kafka + level: ERROR + AppenderRef: + - ref: stdout diff --git a/package-kafka-serde-tools/pom.xml b/package-kafka-serde-tools/pom.xml index b6c7e722afb..046d7be294a 100644 --- a/package-kafka-serde-tools/pom.xml +++ b/package-kafka-serde-tools/pom.xml @@ -133,12 +133,12 @@ org.apache.kafka connect-runtime provided - - - org.slf4j - slf4j-log4j12 - - + + + org.slf4j + slf4j-log4j12 + + org.apache.kafka diff --git a/protobuf-converter/src/test/resources/log4j2.xml b/protobuf-converter/src/test/resources/log4j2.xml deleted file mode 100644 index adfcae8ecc7..00000000000 --- a/protobuf-converter/src/test/resources/log4j2.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/protobuf-converter/src/test/resources/log4j2.yaml b/protobuf-converter/src/test/resources/log4j2.yaml new file mode 100644 index 00000000000..582a8be651a --- /dev/null +++ b/protobuf-converter/src/test/resources/log4j2.yaml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to you under the Apache License, Version 2.0 +# (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.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: TRACE + AppenderRef: + - ref: stdout diff --git a/schema-rules/src/test/resources/log4j2.xml b/schema-rules/src/test/resources/log4j2.xml deleted file mode 100644 index 6bc08c56e3d..00000000000 --- a/schema-rules/src/test/resources/log4j2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/schema-rules/src/test/resources/log4j2.yaml b/schema-rules/src/test/resources/log4j2.yaml new file mode 100644 index 00000000000..30c6789e18f --- /dev/null +++ b/schema-rules/src/test/resources/log4j2.yaml @@ -0,0 +1,13 @@ +Configuration: + name: Log4j2 + Appenders: + Console: + name: stdout + target: SYSTEM_OUT + PatternLayout: + pattern: "[%d] %p %m (%c:%L)%n" + Loggers: + Root: + level: INFO + AppenderRef: + - ref: stdout