diff --git a/LICENSE-binary b/LICENSE-binary index 6fad2bc439ee..ce25eb1c24f5 100644 --- a/LICENSE-binary +++ b/LICENSE-binary @@ -220,6 +220,7 @@ jackson-annotations-2.16.2 jackson-core-2.16.2 jackson-databind-2.16.2 jackson-dataformat-csv-2.16.2 +jackson-dataformat-yaml-2.16.2 jackson-datatype-jdk8-2.16.2 jackson-jaxrs-base-2.16.2 jackson-jaxrs-json-provider-2.16.2 diff --git a/build.gradle b/build.gradle index ca44b1b39983..9dd8ce6f0693 100644 --- a/build.gradle +++ b/build.gradle @@ -173,6 +173,7 @@ allprojects { libs.scalaLibrary, libs.scalaReflect, libs.jacksonAnnotations, + libs.jacksonDatabindYaml, // be explicit about the Netty dependency version instead of relying on the version set by // ZooKeeper (potentially older and containing CVEs) libs.nettyHandler, @@ -1090,6 +1091,7 @@ project(':core') { implementation libs.log4j2Core implementation libs.log4j2Api implementation libs.log4j1Bridge2Api + implementation libs.jacksonDatabindYaml testImplementation project(':clients').sourceSets.test.output testImplementation project(':group-coordinator').sourceSets.test.output @@ -1366,6 +1368,7 @@ project(':metadata') { compileOnly libs.log4j2Api compileOnly libs.log4j2Core compileOnly libs.log4j1Bridge2Api + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.jqwik testImplementation libs.mockitoCore @@ -1494,6 +1497,7 @@ project(':group-coordinator') { testImplementation project(':clients').sourceSets.test.output testImplementation project(':server-common').sourceSets.test.output testImplementation project(':coordinator-common').sourceSets.test.output + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore @@ -1556,6 +1560,7 @@ project(':test-common') { implementation project(':storage') implementation project(':server-common') implementation libs.slf4jApi + implementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore @@ -1857,6 +1862,7 @@ project(':clients') { testImplementation libs.bcpkix testImplementation libs.jacksonJaxrsJsonProvider + testImplementation libs.jacksonDatabindYaml testImplementation libs.jose4j testImplementation libs.junitJupiter testImplementation libs.log4j2Api @@ -2025,11 +2031,13 @@ project(':raft') { implementation project(':clients') implementation libs.slf4jApi implementation libs.jacksonDatabind + implementation libs.jacksonDatabindYaml testImplementation project(':server-common') testImplementation project(':server-common').sourceSets.test.output testImplementation project(':clients') testImplementation project(':clients').sourceSets.test.output + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore testImplementation libs.jqwik @@ -2125,6 +2133,7 @@ project(':server-common') { testImplementation project(':clients') testImplementation project(':clients').sourceSets.test.output + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore @@ -2258,6 +2267,7 @@ project(':storage') { testImplementation project(':server-common') testImplementation project(':server-common').sourceSets.test.output testImplementation libs.hamcrest + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore testImplementation libs.bcpkix @@ -2566,6 +2576,7 @@ project(':shell') { testImplementation project(':core') testImplementation project(':server-common') testImplementation project(':server-common').sourceSets.test.output + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testRuntimeOnly runtimeTestLibs @@ -2617,6 +2628,7 @@ project(':streams') { testImplementation libs.log4j2Api testImplementation libs.log4j2Core testImplementation libs.log4j1Bridge2Api + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.bcpkix testImplementation libs.hamcrest @@ -2763,6 +2775,7 @@ project(':streams:streams-scala') { testImplementation project(':clients').sourceSets.test.output testImplementation project(':streams:test-utils') + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoJunitJupiter // supports MockitoExtension testRuntimeOnly runtimeTestLibs @@ -2819,6 +2832,7 @@ project(':streams:integration-tests') { testImplementation project(':transaction-coordinator') testImplementation libs.bcpkix testImplementation libs.hamcrest + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.junitPlatformSuiteEngine // supports suite test testImplementation libs.mockitoCore @@ -2864,6 +2878,7 @@ project(':streams:test-utils') { implementation libs.slf4jApi testImplementation project(':clients').sourceSets.test.output + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore testImplementation libs.hamcrest @@ -3554,6 +3569,7 @@ project(':connect:runtime') { testImplementation project(':server-common').sourceSets.test.output testImplementation project(':test-common:test-common-api') + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore testImplementation libs.mockitoJunitJupiter @@ -3659,6 +3675,7 @@ project(':connect:file') { runtimeOnly libs.log4j2Core runtimeOnly libs.log4j1Bridge2Api + testImplementation libs.jacksonDatabindYaml testImplementation libs.junitJupiter testImplementation libs.mockitoCore @@ -3765,6 +3782,7 @@ project(':connect:mirror') { testImplementation libs.log4j2Core testImplementation libs.log4j1Bridge2Api testImplementation libs.bndlib + testImplementation libs.jacksonDatabindYaml testImplementation libs.mockitoCore testImplementation project(':clients').sourceSets.test.output testImplementation project(':connect:runtime').sourceSets.test.output diff --git a/clients/src/test/resources/log4j2.properties b/clients/src/test/resources/log4j2.properties deleted file mode 100644 index 34a7d635ecd0..000000000000 --- a/clients/src/test/resources/log4j2.properties +++ /dev/null @@ -1,36 +0,0 @@ -# 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. -name=TestConfig -appenders=console - - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n - -# Root logger configuration -rootLogger.level=OFF -rootLogger.appenderRefs=console -rootLogger.appenderRef.stdout.ref=STDOUT - -loggers=kafkaLogger,CommonNameLoggingTrustManagerFactoryWrapperLogger - -logger.kafkaLogger.name=org.apache.kafka -logger.kafkaLogger.level=ERROR - -# We are testing for a particular INFO log message in CommonNameLoggingTrustManagerFactoryWrapper -logger.CommonNameLoggingTrustManagerFactoryWrapperLogger.name=org.apache.kafka.common.security.ssl.CommonNameLoggingTrustManagerFactoryWrapper -logger.CommonNameLoggingTrustManagerFactoryWrapperLogger.level=INFO diff --git a/clients/src/test/resources/log4j2.yaml b/clients/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..bfe8b3835a0c --- /dev/null +++ b/clients/src/test/resources/log4j2.yaml @@ -0,0 +1,38 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: OFF + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: ERROR + # We are testing for a particular INFO log message in CommonNameLoggingTrustManagerFactoryWrapper + - name: org.apache.kafka.common.security.ssl.CommonNameLoggingTrustManagerFactoryWrapper + level: INFO diff --git a/config/connect-log4j2.properties b/config/connect-log4j2.properties deleted file mode 100644 index 6de453777423..000000000000 --- a/config/connect-log4j2.properties +++ /dev/null @@ -1,39 +0,0 @@ -# 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. - -name=ConnectConfig - -appenders=console, file - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n - -appender.file.type=RollingFile -appender.file.name=ConnectAppender -appender.file.fileName=${kafka.logs.dir}/connect.log -appender.file.filePattern=${kafka.logs.dir}/connect-%d{yyyy-MM-dd-HH}.log -appender.file.layout.type=PatternLayout -appender.file.layout.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n -appender.file.policies.type=Policies -appender.file.policies.time.type=TimeBasedTriggeringPolicy -appender.file.policies.time.interval=1 -appender.file.policies.time.modulate=true - -rootLogger.level=INFO -rootLogger.appenderRefs=console,file -rootLogger.appenderRef.console.ref=STDOUT -rootLogger.appenderRef.file.ref=ConnectAppender diff --git a/config/connect-log4j2.yaml b/config/connect-log4j2.yaml new file mode 100644 index 000000000000..89a9a9673658 --- /dev/null +++ b/config/connect-log4j2.yaml @@ -0,0 +1,44 @@ +# 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: + Properties: + Property: + - name: "kafka.logs.dir" + value: "." + - name: "logPattern" + value: "[%d] %p %X{connector.context}%m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + RollingFile: + - name: ConnectAppender + fileName: "${sys:kafka.logs.dir}/connect.log" + filePattern: "${sys:kafka.logs.dir}/connect-%d{yyyy-MM-dd-HH}.log" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + - ref: ConnectAppender diff --git a/config/log4j2.properties b/config/log4j2.properties deleted file mode 100644 index 3e8601d5f448..000000000000 --- a/config/log4j2.properties +++ /dev/null @@ -1,158 +0,0 @@ -# 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. - -# Unspecified loggers and loggers with additivity=true output to server.log and stdout -# Note that INFO only applies to unspecified loggers, the log level of the child logger is used otherwise -name=LogConfig -appenders=stdout,kafkaAppender,stateChangeAppender,requestAppender,cleanerAppender,controllerAppender,authorizerAppender - -# Console appender (stdout) -appender.stdout.type=Console -appender.stdout.name=STDOUT -appender.stdout.layout.type=PatternLayout -appender.stdout.layout.pattern=[%d] %p %m (%c)%n - -appender.kafkaAppender.type=RollingFile -appender.kafkaAppender.name=KafkaAppender -appender.kafkaAppender.fileName=${kafka.logs.dir}/server.log -appender.kafkaAppender.filePattern=${kafka.logs.dir}/server.log.%d{yyyy-MM-dd-HH} -appender.kafkaAppender.layout.type=PatternLayout -appender.kafkaAppender.layout.pattern=[%d] %p %m (%c)%n -appender.kafkaAppender.policies.type=TimeBasedTriggeringPolicy -appender.kafkaAppender.policies.interval=1 -appender.kafkaAppender.policies.modulate=true - -# State Change appender -appender.stateChangeAppender.type=RollingFile -appender.stateChangeAppender.name=StateChangeAppender -appender.stateChangeAppender.fileName=${kafka.logs.dir}/state-change.log -appender.stateChangeAppender.filePattern=${kafka.logs.dir}/state-change.log.%d{yyyy-MM-dd-HH} -appender.stateChangeAppender.layout.type=PatternLayout -appender.stateChangeAppender.layout.pattern=[%d] %p %m (%c)%n -appender.stateChangeAppender.policies.type=TimeBasedTriggeringPolicy -appender.stateChangeAppender.policies.interval=1 -appender.stateChangeAppender.policies.modulate=true - -# Request appender -appender.requestAppender.type=RollingFile -appender.requestAppender.name=RequestAppender -appender.requestAppender.fileName=${kafka.logs.dir}/kafka-request.log -appender.requestAppender.filePattern=${kafka.logs.dir}/kafka-request.log.%d{yyyy-MM-dd-HH} -appender.requestAppender.layout.type=PatternLayout -appender.requestAppender.layout.pattern=[%d] %p %m (%c)%n -appender.requestAppender.policies.type=TimeBasedTriggeringPolicy -appender.requestAppender.policies.interval=1 -appender.requestAppender.policies.modulate=true - -# Cleaner appender -appender.cleanerAppender.type=RollingFile -appender.cleanerAppender.name=CleanerAppender -appender.cleanerAppender.fileName=${kafka.logs.dir}/log-cleaner.log -appender.cleanerAppender.filePattern=${kafka.logs.dir}/log-cleaner.log.%d{yyyy-MM-dd-HH} -appender.cleanerAppender.layout.type=PatternLayout -appender.cleanerAppender.layout.pattern=[%d] %p %m (%c)%n -appender.cleanerAppender.policies.type=TimeBasedTriggeringPolicy -appender.cleanerAppender.policies.interval=1 -appender.cleanerAppender.policies.modulate=true - -# Controller appender -appender.controllerAppender.type=RollingFile -appender.controllerAppender.name=ControllerAppender -appender.controllerAppender.fileName=${kafka.logs.dir}/controller.log -appender.controllerAppender.filePattern=${kafka.logs.dir}/controller.log.%d{yyyy-MM-dd-HH} -appender.controllerAppender.layout.type=PatternLayout -appender.controllerAppender.layout.pattern=[%d] %p %m (%c)%n -appender.controllerAppender.policies.type=TimeBasedTriggeringPolicy -appender.controllerAppender.policies.interval=1 -appender.controllerAppender.policies.modulate=true - -# Authorizer appender -appender.authorizerAppender.type=RollingFile -appender.authorizerAppender.name=AuthorizerAppender -appender.authorizerAppender.fileName=${kafka.logs.dir}/kafka-authorizer.log -appender.authorizerAppender.filePattern=${kafka.logs.dir}/kafka-authorizer.log.%d{yyyy-MM-dd-HH} -appender.authorizerAppender.layout.type=PatternLayout -appender.authorizerAppender.layout.pattern=[%d] %p %m (%c)%n -appender.authorizerAppender.policies.type=TimeBasedTriggeringPolicy -appender.authorizerAppender.policies.interval=1 -appender.authorizerAppender.policies.modulate=true - -rootLogger.level=INFO -rootLogger.appenderRefs=stdout,kafkaAppender -rootLogger.appenderRef.stdout.ref=STDOUT -rootLogger.appenderRef.kafkaAppender.ref=KafkaAppender - -loggers=kafka,apacheKafka,requestLogger,networkRequestChannel,apacheKafkaController,kafkaController,logCleaner,stateChangeLogger,authorizerLogger - -# Kafka logger -logger.kafka.name=kafka -logger.kafka.level=INFO - -# Kafka org.apache logger -logger.apacheKafka.name=org.apache.kafka -logger.apacheKafka.level=INFO - -# Kafka request logger -logger.requestLogger.name=kafka.request.logger -logger.requestLogger.level=WARN -logger.requestLogger.additivity=false -logger.requestLogger.appenderRef.requestAppender.ref=RequestAppender - - -# Uncomment the lines below and change log4j.logger.kafka.network.RequestChannel$ to TRACE for additional output -# related to the handling of requests -#logger.networkProcessor.name=kafka.network.Processor -#logger.networkProcessor.level=TRACE -#logger.networkProcessor.appenderRef.requestAppender.ref=RequestAppender -#logger.serverKafkaApis.name=kafka.server.KafkaApis -#logger.serverKafkaApis.level=TRACE -#logger.serverKafkaApis.additivity=false -#logger.serverKafkaApis.appenderRef.requestAppender.ref=RequestAppender - -# Kafka network RequestChannel$ logger -logger.networkRequestChannel.name=kafka.network.RequestChannel$ -logger.networkRequestChannel.level=WARN -logger.networkRequestChannel.additivity=false -logger.networkRequestChannel.appenderRef.requestAppender.ref=RequestAppender - -# KRaft mode controller logger -logger.apacheKafkaController.name=org.apache.kafka.controller -logger.apacheKafkaController.level=INFO -logger.apacheKafkaController.additivity=false -logger.apacheKafkaController.appenderRef.controllerAppender.ref=ControllerAppender - -# ZK mode controller logger -logger.kafkaController.name=kafka.controller -logger.kafkaController.level=TRACE -logger.kafkaController.additivity=false -logger.kafkaController.appenderRef.controllerAppender.ref=ControllerAppender - -# LogCleaner logger -logger.logCleaner.name=kafka.log.LogCleaner -logger.logCleaner.level=INFO -logger.logCleaner.additivity=false -logger.logCleaner.appenderRef.cleanerAppender.ref=CleanerAppender - -# State change logger -logger.stateChangeLogger.name=state.change.logger -logger.stateChangeLogger.level=INFO -logger.stateChangeLogger.additivity=false -logger.stateChangeLogger.appenderRef.stateChangeAppender.ref=StateChangeAppender - -# Authorizer logger -logger.authorizerLogger.name=kafka.authorizer.logger -logger.authorizerLogger.level=INFO -logger.authorizerLogger.additivity=false -logger.authorizerLogger.appenderRef.authorizerAppender.ref=AuthorizerAppender diff --git a/config/log4j2.yaml b/config/log4j2.yaml new file mode 100644 index 000000000000..2b000d407e2f --- /dev/null +++ b/config/log4j2.yaml @@ -0,0 +1,158 @@ +# 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. + +# Unspecified loggers and loggers with additivity=true output to server.log and stdout +# Note that INFO only applies to unspecified loggers, the log level of the child logger is used otherwise +Configuration: + Properties: + Property: + # Fallback if the system property is not set + - name: "kafka.logs.dir" + value: "." + - name: "logPattern" + value: "[%d] %p %m (%c)%n" + + # Appenders configuration + # See: https://logging.apache.org/log4j/2.x/manual/appenders.html + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + RollingFile: + - name: KafkaAppender + fileName: "${sys:kafka.logs.dir}/server.log" + filePattern: "${sys:kafka.logs.dir}/server.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + # State Change appender + - name: StateChangeAppender + fileName: "${sys:kafka.logs.dir}/state-change.log" + filePattern: "${sys:kafka.logs.dir}/stage-change.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + # Request appender + - name: RequestAppender + fileName: "${sys:kafka.logs.dir}/kafka-request.log" + filePattern: "${sys:kafka.logs.dir}/kafka-request.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + # Cleaner appender + - name: CleanerAppender + fileName: "${sys:kafka.logs.dir}/log-cleaner.log" + filePattern: "${sys:kafka.logs.dir}/log-cleaner.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + # Controller appender + - name: ControllerAppender + fileName: "${sys:kafka.logs.dir}/controller.log" + filePattern: "${sys:kafka.logs.dir}/controller.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + # Authorizer appender + - name: AuthorizerAppender + fileName: "${sys:kafka.logs.dir}/kafka-authorizer.log" + filePattern: "${sys:kafka.logs.dir}/kafka-authorizer.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + + # Loggers configuration + # See: https://logging.apache.org/log4j/2.x/manual/configuration.html#configuring-loggers + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + - ref: KafkaAppender + Logger: + # Kafka logger + - name: kafka + level: INFO + # Kafka org.apache logger + - name: org.apache.kafka + level: INFO + # Kafka request logger + - name: kafka.request.logger + level: WARN + additivity: false + AppenderRef: + ref: RequestAppender + # Uncomment the lines below and change log4j.logger.kafka.network.RequestChannel$ to TRACE + # for additional output related to the handling of requests +# - name: kafka.network.Processor +# level: TRACE +# additivity: false +# AppenderRef: +# ref: RequestAppender +# - name: kafka.server.KafkaApis +# level: TRACE +# additivity: false +# AppenderRef: +# ref: RequestAppender + # Kafka network RequestChannel$ logger + - name: kafka.network.RequestChannel$ + level: WARN + additivity: false + AppenderRef: + ref: RequestAppender + # KRaft mode controller logger + - name: org.apache.kafka.controller + level: INFO + additivity: false + AppenderRef: + ref: ControllerAppender + # ZK mode controller logger + - name: kafka.controller + level: TRACE + additivity: false + AppenderRef: + ref: ControllerAppender + # LogCleaner logger + - name: kafka.log.LogCleaner + level: INFO + additivity: false + AppenderRef: + ref: CleanerAppender + # State change logger + - name: state.change.logger + level: INFO + additivity: false + AppenderRef: + ref: StateChangeAppender + # Authorizer logger + - name: kafka.authorizer.logger + level: INFO + additivity: false + AppenderRef: + ref: AuthorizerAppender \ No newline at end of file diff --git a/connect/file/src/test/resources/log4j2.properties b/connect/file/src/test/resources/log4j2.properties deleted file mode 100644 index 101b56d63c71..000000000000 --- a/connect/file/src/test/resources/log4j2.properties +++ /dev/null @@ -1,36 +0,0 @@ -## -# 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. -## -name=ConnectFileTestConfig - -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -# -# The `%X{connector.context}` parameter in the layout includes connector-specific and task-specific information -# in the log message, where appropriate. This makes it easier to identify those log messages that apply to a -# specific connector. Simply add this parameter to the log layout configuration below to include the contextual information. -# -appender.stdout.layout.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.stdout.ref=STDOUT - -loggers=kafka -logger.kafka.name=kafka -logger.kafka.level=WARN diff --git a/group-coordinator/src/test/resources/log4j2.properties b/connect/file/src/test/resources/log4j2.yaml similarity index 57% rename from group-coordinator/src/test/resources/log4j2.properties rename to connect/file/src/test/resources/log4j2.yaml index 0284fc835419..1e9f550fa6d6 100644 --- a/group-coordinator/src/test/resources/log4j2.properties +++ b/connect/file/src/test/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,19 +12,24 @@ # 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. -name=TestConfig -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %X{connector.context}%m (%c:%L)%n" -rootLogger.level=DEBUG -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" -loggers=kafka - -logger.kafka.name=org.apache.kafka -logger.kafka.level=DEBUG + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: WARN diff --git a/connect/mirror/src/test/resources/log4j2.properties b/connect/mirror/src/test/resources/log4j2.properties deleted file mode 100644 index aa5596ecd19b..000000000000 --- a/connect/mirror/src/test/resources/log4j2.properties +++ /dev/null @@ -1,43 +0,0 @@ -## -# 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. -## -name=ConnectMirrorTestConfig - -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -# -# The `%X{connector.context}` parameter in the layout includes connector-specific and task-specific information -# in the log message, where appropriate. This makes it easier to identify those log messages that apply to a -# specific connector. Simply add this parameter to the log layout configuration below to include the contextual information. -# -appender.console.layout.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n - -loggers=kafka,stateChangeLogger,kafkaConnectLogger - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT - -logger.kafka.name=kafka -logger.kafka.level=WARN - -logger.stateChangeLogger.name=state.change.logger -logger.stateChangeLogger.level=OFF - -logger.kafkaConnectLogger.name=org.apache.kafka.connect -logger.kafkaConnectLogger.level=DEBUG diff --git a/raft/src/test/resources/log4j2.properties b/connect/mirror/src/test/resources/log4j2.yaml similarity index 52% rename from raft/src/test/resources/log4j2.properties rename to connect/mirror/src/test/resources/log4j2.yaml index ed4c9a98da66..b63606d0ba56 100644 --- a/raft/src/test/resources/log4j2.properties +++ b/connect/mirror/src/test/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,22 +12,30 @@ # 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. -name=TestConfig -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %X{connector.context}%m (%c:%L)%n" -rootLogger.level=OFF -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" -loggers=raft,snapshot + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: WARN -logger.raft.name=org.apache.kafka.raft -logger.raft.level=ERROR + - name: state.change.logger + level: "OFF" -logger.snapshot.name=org.apache.kafka.snapshot -logger.snapshot.level=ERROR + - name: org.apache.kafka.connect + level: DEBUG diff --git a/connect/runtime/src/test/resources/log4j2.properties b/connect/runtime/src/test/resources/log4j2.properties deleted file mode 100644 index 462b9d7e4813..000000000000 --- a/connect/runtime/src/test/resources/log4j2.properties +++ /dev/null @@ -1,49 +0,0 @@ -## -# 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. -## -name=ConnectRuntimeTestConfig -appenders=console - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -# -# The `%X{connector.context}` parameter in the layout includes connector-specific and task-specific information -# in the log message, where appropriate. This makes it easier to identify those log messages that apply to a -# specific connector. Simply add this parameter to the log layout configuration below to include the contextual information. -# -appender.console.layout.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n - -loggers=kafka,stateChangeLogger,kafkaConnect,kafkaConsumer,coordinatorGroup - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT - -logger.kafka.name=kafka -logger.kafka.level=WARN - -logger.stateChangeLogger.name=state.change.logger -logger.stateChangeLogger.level=OFF - -logger.kafkaConnect.name=org.apache.kafka.connect -logger.kafkaConnect.level=DEBUG - -# Troubleshooting KAFKA-17493. -logger.kafkaConsumer.name=org.apache.kafka.consumer -logger.kafkaConsumer.level=DEBUG -logger.coordinatorGroup.name=org.apache.kafka.coordinator.group -logger.coordinatorGroup.level=DEBUG diff --git a/connect/runtime/src/test/resources/log4j2.yaml b/connect/runtime/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..45faa635378a --- /dev/null +++ b/connect/runtime/src/test/resources/log4j2.yaml @@ -0,0 +1,48 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %X{connector.context}%m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: WARN + + - name: state.change.logger + level: "OFF" + + - name: org.apache.kafka.connect + level: DEBUG + + # Troubleshooting KAFKA-17493. + - name: org.apache.kafka.consumer + level: DEBUG + + - name: org.apache.kafka.coordinator.group + level: DEBUG diff --git a/metadata/src/test/resources/log4j2.properties b/core/src/test/resources/log4j2.yaml similarity index 56% rename from metadata/src/test/resources/log4j2.properties rename to core/src/test/resources/log4j2.yaml index 0284fc835419..016a542689b4 100644 --- a/metadata/src/test/resources/log4j2.properties +++ b/core/src/test/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,19 +12,27 @@ # 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. -name=TestConfig -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" -rootLogger.level=DEBUG -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" -loggers=kafka + Loggers: + Root: + level: OFF + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: WARN -logger.kafka.name=org.apache.kafka -logger.kafka.level=DEBUG + - name: org.apache.kafka + level: WARN diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index ff184f6909b4..7414e43aa4cc 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -160,6 +160,7 @@ libs += [ commonsValidator: "commons-validator:commons-validator:$versions.commonsValidator", jacksonAnnotations: "com.fasterxml.jackson.core:jackson-annotations:$versions.jackson", jacksonDatabind: "com.fasterxml.jackson.core:jackson-databind:$versions.jackson", + jacksonDatabindYaml: "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$versions.jackson", jacksonDataformatCsv: "com.fasterxml.jackson.dataformat:jackson-dataformat-csv:$versions.jackson", jacksonModuleScala: "com.fasterxml.jackson.module:jackson-module-scala_$versions.baseScala:$versions.jackson", jacksonJDK8Datatypes: "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$versions.jackson", diff --git a/group-coordinator/src/test/resources/log4j2.yaml b/group-coordinator/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..59b02951909e --- /dev/null +++ b/group-coordinator/src/test/resources/log4j2.yaml @@ -0,0 +1,31 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: DEBUG + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: DEBUG diff --git a/server-common/src/test/resources/log4j2.properties b/metadata/src/test/resources/log4j2.yaml similarity index 57% rename from server-common/src/test/resources/log4j2.properties rename to metadata/src/test/resources/log4j2.yaml index a12aced7a9c6..fd94a4974e2d 100644 --- a/server-common/src/test/resources/log4j2.properties +++ b/metadata/src/test/resources/log4j2.yaml @@ -1,9 +1,10 @@ + # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,19 +13,24 @@ # 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. -name=TestConfig -appenders=console - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" -loggers=kafka + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" -logger.kafka.name=org.apache.kafka -logger.kafka.level=INFO + Loggers: + Root: + level: DEBUG + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: DEBUG diff --git a/raft/config/kraft-log4j2.properties b/raft/config/kraft-log4j2.properties deleted file mode 100644 index 4da4ae448769..000000000000 --- a/raft/config/kraft-log4j2.properties +++ /dev/null @@ -1,35 +0,0 @@ -# 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. - -name=RaftConfig -appenders=console - -appender.console.type=Console -appender.console.name=STDERR -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c)%n -appender.console.target=SYSTEM_ERR - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDERR - -loggers=raft,snapshot - -logger.raft.name=org.apache.kafka.raft -logger.raft.level=INFO - -logger.snapshot.name=org.apache.kafka.snapshot -logger.snapshot.level=INFO diff --git a/raft/config/kraft-log4j2.yaml b/raft/config/kraft-log4j2.yaml new file mode 100644 index 000000000000..3bfd01ca5cfc --- /dev/null +++ b/raft/config/kraft-log4j2.yaml @@ -0,0 +1,39 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c)%n" + + Appenders: + Console: + name: STDERR + target: SYSTEM_ERR + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDERR + Logger: + - name: org.apache.kafka.raft + level: INFO + + - name: org.apache.kafka.snapshot + level: INFO diff --git a/streams/test-utils/src/test/resources/log4j2.properties b/raft/src/test/resources/log4j2.yaml similarity index 54% rename from streams/test-utils/src/test/resources/log4j2.properties rename to raft/src/test/resources/log4j2.yaml index 51f3728b70e4..50d9e781b8ec 100644 --- a/streams/test-utils/src/test/resources/log4j2.properties +++ b/raft/src/test/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,19 +12,27 @@ # 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. -name=StreamsTestUtilsTestConfig -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" -loggers=kafka + Loggers: + Root: + level: OFF + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka.raft + level: ERROR -logger.kafka.name=org.apache.kafka -logger.kafka.level=INFO + - name: org.apache.kafka.snapshot + level: ERROR diff --git a/server-common/src/test/resources/log4j2.yaml b/server-common/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..be546a18b55e --- /dev/null +++ b/server-common/src/test/resources/log4j2.yaml @@ -0,0 +1,35 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: INFO diff --git a/shell/src/test/resources/log4j2.properties b/shell/src/test/resources/log4j2.yaml similarity index 61% rename from shell/src/test/resources/log4j2.properties rename to shell/src/test/resources/log4j2.yaml index 2b0b46645f1c..c229cbce316d 100644 --- a/shell/src/test/resources/log4j2.properties +++ b/shell/src/test/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,14 +12,21 @@ # 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. -name=TestConfig -appenders=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" -rootLogger.level=DEBUG -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: DEBUG + AppenderRef: + - ref: STDOUT diff --git a/storage/src/test/resources/log4j2.properties b/storage/src/test/resources/log4j2.properties deleted file mode 100644 index 91db144ec94e..000000000000 --- a/storage/src/test/resources/log4j2.properties +++ /dev/null @@ -1,53 +0,0 @@ -# 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. -name=TestConfig -appenders=console,file - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n - -appender.file.type=RollingFile -appender.file.name=FileAppender -appender.file.fileName=storage.log -appender.file.layout.type=PatternLayout -appender.file.layout.pattern=%d [%t] %-5p %c %x - %m%n - -appender.file.filePattern=storage-%d{yyyy-MM-dd}.log -appender.file.policies.type=Policies -appender.file.policies.time.type=TimeBasedTriggeringPolicy -appender.file.policies.time.interval=1 - -rootLogger.level=OFF -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT - -loggers=remoteStorage,remoteMetadataStorage,remote - -logger.remoteStorage.name=org.apache.kafka.server.log.remote.storage -logger.remoteStorage.level=INFO -logger.remoteStorage.appenderRefs=file -logger.remoteStorage.appenderRef.fileAppender.ref=FileAppender - -logger.remoteMetadataStorage.name=org.apache.kafka.server.log.remote.metadata.storage -logger.remoteMetadataStorage.level=INFO -logger.remoteMetadataStorage.appenderRefs=file -logger.remoteMetadataStorage.appenderRef.fileAppender.ref=FileAppender - -logger.remote.name=kafka.log.remote -logger.remote.level=INFO -logger.remote.appenderRefs=file -logger.remote.appenderRef.fileAppender.ref=FileAppender diff --git a/storage/src/test/resources/log4j2.yaml b/storage/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..4117e2f14861 --- /dev/null +++ b/storage/src/test/resources/log4j2.yaml @@ -0,0 +1,58 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + - name: "fileLogPattern" + value: "%d [%t] %-5p %c %x - %m%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + RollingFile: + - name: FileAppender + fileName: storage.log + filePattern: "storage-%d{yyyy-MM-dd}.log" + PatternLayout: + pattern: "${fileLogPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + + Loggers: + Root: + level: OFF + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka.server.log.remote.storage + level: INFO + AppenderRef: + - ref: FileAppender + + - name: org.apache.kafka.server.log.remote.metadata.storage + level: INFO + AppenderRef: + - ref: FileAppender + + - name: kafka.log.remote + level: INFO + AppenderRef: + - ref: FileAppender diff --git a/streams/integration-tests/src/test/resources/log4j2.properties b/streams/integration-tests/src/test/resources/log4j2.properties deleted file mode 100644 index aaf3b14f667e..000000000000 --- a/streams/integration-tests/src/test/resources/log4j2.properties +++ /dev/null @@ -1,61 +0,0 @@ -# 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. -# Appender Configuration -name=TestConfig -appenders=console - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.stdout.ref=STDOUT - -loggers=kafka,stateChangeLogger,apacheKafka,kafkaClients,consumer,producer,streams,producerConfig,consumerConfig,adminClientConfig,streamsConfig - -logger.kafka.name=kafka -logger.kafka.level=ERROR - -logger.stateChangeLogger.name=state.change.logger -logger.stateChangeLogger.level=ERROR - -logger.apacheKafka.name=org.apache.kafka -logger.apacheKafka.level=ERROR - -logger.kafkaClients.name=org.apache.kafka.clients -logger.kafkaClients.level=ERROR - -logger.consumer.name=org.apache.kafka.clients.consumer -logger.consumer.level=INFO - -logger.producer.name=org.apache.kafka.clients.producer -logger.producer.level=INFO - -logger.streams.name=org.apache.kafka.streams -logger.streams.level=INFO - -logger.producerConfig.name=org.apache.kafka.clients.producer.ProducerConfig -logger.producerConfig.level=ERROR - -logger.consumerConfig.name=org.apache.kafka.clients.consumer.ConsumerConfig -logger.consumerConfig.level=ERROR - -logger.adminClientConfig.name=org.apache.kafka.clients.admin.AdminClientConfig -logger.adminClientConfig.level=ERROR - -logger.streamsConfig.name=org.apache.kafka.streams.StreamsConfig -logger.streamsConfig.level=ERROR diff --git a/streams/integration-tests/src/test/resources/log4j2.yaml b/streams/integration-tests/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..0942036a33c8 --- /dev/null +++ b/streams/integration-tests/src/test/resources/log4j2.yaml @@ -0,0 +1,65 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: ERROR + + - name: state.change.logger + level: ERROR + + - name: org.apache.kafka + level: ERROR + + - name: org.apache.kafka.clients + level: ERROR + + - name: org.apache.kafka.clients.consumer + level: INFO + + - name: org.apache.kafka.clients.producer + level: INFO + + - name: org.apache.kafka.streams + level: INFO + + - name: org.apache.kafka.clients.producer.ProducerConfig + level: ERROR + + - name: org.apache.kafka.clients.consumer.ConsumerConfig + level: ERROR + + - name: org.apache.kafka.clients.admin.AdminClientConfig + level: ERROR + + - name: org.apache.kafka.streams.StreamsConfig + level: ERROR diff --git a/streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.properties b/streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.yaml similarity index 58% rename from streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.properties rename to streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.yaml index f656fe5e7abd..0c112dd06d6e 100644 --- a/streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.properties +++ b/streams/quickstart/java/src/main/resources/archetype-resources/src/main/resources/log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,14 +12,21 @@ # 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. -name=StreamsQuickstartConfig -appenders=console -appender.console.type=Console -appender.console.name=ConsoleAppender -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n +Configuration: + Properties: + Property: + - name: "logPattern" + value: "%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n" -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=ConsoleAppender + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT diff --git a/streams/src/test/resources/log4j2.properties b/streams/src/test/resources/log4j2.properties deleted file mode 100644 index aaf3b14f667e..000000000000 --- a/streams/src/test/resources/log4j2.properties +++ /dev/null @@ -1,61 +0,0 @@ -# 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. -# Appender Configuration -name=TestConfig -appenders=console - -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n - -rootLogger.level=INFO -rootLogger.appenderRefs=console -rootLogger.appenderRef.stdout.ref=STDOUT - -loggers=kafka,stateChangeLogger,apacheKafka,kafkaClients,consumer,producer,streams,producerConfig,consumerConfig,adminClientConfig,streamsConfig - -logger.kafka.name=kafka -logger.kafka.level=ERROR - -logger.stateChangeLogger.name=state.change.logger -logger.stateChangeLogger.level=ERROR - -logger.apacheKafka.name=org.apache.kafka -logger.apacheKafka.level=ERROR - -logger.kafkaClients.name=org.apache.kafka.clients -logger.kafkaClients.level=ERROR - -logger.consumer.name=org.apache.kafka.clients.consumer -logger.consumer.level=INFO - -logger.producer.name=org.apache.kafka.clients.producer -logger.producer.level=INFO - -logger.streams.name=org.apache.kafka.streams -logger.streams.level=INFO - -logger.producerConfig.name=org.apache.kafka.clients.producer.ProducerConfig -logger.producerConfig.level=ERROR - -logger.consumerConfig.name=org.apache.kafka.clients.consumer.ConsumerConfig -logger.consumerConfig.level=ERROR - -logger.adminClientConfig.name=org.apache.kafka.clients.admin.AdminClientConfig -logger.adminClientConfig.level=ERROR - -logger.streamsConfig.name=org.apache.kafka.streams.StreamsConfig -logger.streamsConfig.level=ERROR diff --git a/streams/src/test/resources/log4j2.yaml b/streams/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..0942036a33c8 --- /dev/null +++ b/streams/src/test/resources/log4j2.yaml @@ -0,0 +1,65 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: kafka + level: ERROR + + - name: state.change.logger + level: ERROR + + - name: org.apache.kafka + level: ERROR + + - name: org.apache.kafka.clients + level: ERROR + + - name: org.apache.kafka.clients.consumer + level: INFO + + - name: org.apache.kafka.clients.producer + level: INFO + + - name: org.apache.kafka.streams + level: INFO + + - name: org.apache.kafka.clients.producer.ProducerConfig + level: ERROR + + - name: org.apache.kafka.clients.consumer.ConsumerConfig + level: ERROR + + - name: org.apache.kafka.clients.admin.AdminClientConfig + level: ERROR + + - name: org.apache.kafka.streams.StreamsConfig + level: ERROR diff --git a/streams/streams-scala/src/test/resources/log4j2.properties b/streams/streams-scala/src/test/resources/log4j2.properties deleted file mode 100644 index 9284c02f92f8..000000000000 --- a/streams/streams-scala/src/test/resources/log4j2.properties +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2018 Lightbend Inc. -# Copyright (C) 2017-2018 Alexis Seigneurin. -# -# 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. - -name=StreamsScalaTestConfig -appenders=console,rolling - -appender.console.type=Console -appender.console.name=A1 - -appender.rolling.type=RollingFile -appender.rolling.name=R -appender.rolling.fileName=logs/kafka-streams-scala.log -appender.rolling.filePattern=logs/kafka-streams-scala.log.%i -appender.rolling.layout.type=PatternLayout -appender.rolling.layout.pattern=%-4r [%t] %-5p %c %x - %m%n - -appender.rolling.policies.type=Policies -appender.rolling.policies.size.type=SizeBasedTriggeringPolicy -appender.rolling.policies.size.size=100KB - -appender.rolling.strategy.type=DefaultRolloverStrategy -appender.rolling.strategy.max=1 - -rootLogger.level=INFO -rootLogger.appenderRefs=R -rootLogger.appenderRef.R.ref=R diff --git a/streams/streams-scala/src/test/resources/log4j2.yaml b/streams/streams-scala/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..d34b13ba7038 --- /dev/null +++ b/streams/streams-scala/src/test/resources/log4j2.yaml @@ -0,0 +1,41 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "%-4r [%t] %-5p %c %x - %m%n" + + Appenders: + Console: + name: A1 + RollingFile: + - name: R + fileName: logs/kafka-streams-scala.log + filePattern: "${logPattern}" + PatternLayout: + pattern: "%-4r [%t] %-5p %c %x - %m%n" + Policies: + SizeBasedTriggeringPolicy: + size: "100KB" + DefaultRolloverStrategy: + max: 1 + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: R diff --git a/streams/test-utils/src/test/resources/log4j2.yaml b/streams/test-utils/src/test/resources/log4j2.yaml new file mode 100644 index 000000000000..be546a18b55e --- /dev/null +++ b/streams/test-utils/src/test/resources/log4j2.yaml @@ -0,0 +1,35 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: INFO diff --git a/test-common/src/main/resources/log4j2.yaml b/test-common/src/main/resources/log4j2.yaml new file mode 100644 index 000000000000..be546a18b55e --- /dev/null +++ b/test-common/src/main/resources/log4j2.yaml @@ -0,0 +1,35 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c:%L)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + Loggers: + Root: + level: INFO + AppenderRef: + - ref: STDOUT + Logger: + - name: org.apache.kafka + level: INFO diff --git a/tests/kafkatest/services/kafka/templates/log4j2.properties b/tests/kafkatest/services/kafka/templates/log4j2.properties deleted file mode 100644 index 52934ed37363..000000000000 --- a/tests/kafkatest/services/kafka/templates/log4j2.properties +++ /dev/null @@ -1,298 +0,0 @@ -# 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. - -name=KafkaTestsServicesConfig -appenders=stdout,kafkaInfoAppender,kafkaDebugAppender,stateChangeInfoAppender,stateChangeDebugAppender,requestInfoAppender,requestDebugAppender,cleanerInfoAppender,cleanerDebugAppender,controllerInfoAppender,controllerDebugAppender,authorizerInfoAppender,authorizerDebugAppender - -# Console appender -appender.stdout.type=Console -appender.stdout.name=STDOUT -appender.stdout.layout.type=PatternLayout -appender.stdout.layout.pattern=[%d] %p %m (%c)%n - -# Kafka INFO level appender (RollingFileAppender) -appender.kafkaInfoAppender.type=RollingFile -appender.kafkaInfoAppender.name=KafkaInfoAppender -appender.kafkaInfoAppender.fileName={{ log_dir }}/info/server.log -appender.kafkaInfoAppender.filePattern={{ log_dir }}/info/server.log.%d{yyyy-MM-dd-HH} -appender.kafkaInfoAppender.layout.type=PatternLayout -appender.kafkaInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.kafkaInfoAppender.policies.type=Policies -appender.kafkaInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.kafkaInfoAppender.policies.time.interval=1 -appender.kafkaInfoAppender.filter.threshold.type=ThresholdFilter -appender.kafkaInfoAppender.filter.threshold.level=INFO - -# Kafka DEBUG level appender (RollingFileAppender) -appender.kafkaDebugAppender.type=RollingFile -appender.kafkaDebugAppender.name=KafkaDebugAppender -appender.kafkaDebugAppender.fileName={{ log_dir }}/debug/server.log -appender.kafkaDebugAppender.filePattern={{ log_dir }}/debug/server.log.%d{yyyy-MM-dd-HH} -appender.kafkaDebugAppender.layout.type=PatternLayout -appender.kafkaDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.kafkaDebugAppender.policies.type=Policies -appender.kafkaDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.kafkaDebugAppender.policies.time.interval=1 -appender.kafkaDebugAppender.filter.threshold.type=ThresholdFilter -appender.kafkaDebugAppender.filter.threshold.level=DEBUG - -# State Change INFO level appender -appender.stateChangeInfoAppender.type=RollingFile -appender.stateChangeInfoAppender.name=StateChangeInfoAppender -appender.stateChangeInfoAppender.fileName={{ log_dir }}/info/state-change.log -appender.stateChangeInfoAppender.filePattern={{ log_dir }}/info/state-change.log.%d{yyyy-MM-dd-HH} -appender.stateChangeInfoAppender.layout.type=PatternLayout -appender.stateChangeInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.stateChangeInfoAppender.policies.type=Policies -appender.stateChangeInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.stateChangeInfoAppender.policies.time.interval=1 -appender.stateChangeInfoAppender.filter.threshold.type=ThresholdFilter -appender.stateChangeInfoAppender.filter.threshold.level=INFO - -# State Change DEBUG level appender -appender.stateChangeDebugAppender.type=RollingFile -appender.stateChangeDebugAppender.name=StateChangeDebugAppender -appender.stateChangeDebugAppender.fileName={{ log_dir }}/debug/state-change.log -appender.stateChangeDebugAppender.filePattern={{ log_dir }}/debug/state-change.log.%d{yyyy-MM-dd-HH} -appender.stateChangeDebugAppender.layout.type=PatternLayout -appender.stateChangeDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.stateChangeDebugAppender.policies.type=Policies -appender.stateChangeDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.stateChangeDebugAppender.policies.time.interval=1 -appender.stateChangeDebugAppender.filter.threshold.type=ThresholdFilter -appender.stateChangeDebugAppender.filter.threshold.level=DEBUG - -# Request INFO level appender -appender.requestInfoAppender.type=RollingFile -appender.requestInfoAppender.name=RequestInfoAppender -appender.requestInfoAppender.fileName={{ log_dir }}/info/kafka-request.log -appender.requestInfoAppender.filePattern={{ log_dir }}/info/kafka-request.log.%d{yyyy-MM-dd-HH} -appender.requestInfoAppender.layout.type=PatternLayout -appender.requestInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.requestInfoAppender.policies.type=Policies -appender.requestInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.requestInfoAppender.policies.time.interval=1 -appender.requestInfoAppender.filter.threshold.type=ThresholdFilter -appender.requestInfoAppender.filter.threshold.level=INFO - -# Request DEBUG level appender -appender.requestDebugAppender.type=RollingFile -appender.requestDebugAppender.name=RequestDebugAppender -appender.requestDebugAppender.fileName={{ log_dir }}/debug/kafka-request.log -appender.requestDebugAppender.filePattern={{ log_dir }}/debug/kafka-request.log.%d{yyyy-MM-dd-HH} -appender.requestDebugAppender.layout.type=PatternLayout -appender.requestDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.requestDebugAppender.policies.type=Policies -appender.requestDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.requestDebugAppender.policies.time.interval=1 -appender.requestDebugAppender.filter.threshold.type=ThresholdFilter -appender.requestDebugAppender.filter.threshold.level=DEBUG - -# Cleaner INFO level appender -appender.cleanerInfoAppender.type=RollingFile -appender.cleanerInfoAppender.name=CleanerInfoAppender -appender.cleanerInfoAppender.fileName={{ log_dir }}/info/log-cleaner.log -appender.cleanerInfoAppender.filePattern={{ log_dir }}/info/log-cleaner.log.%d{yyyy-MM-dd-HH} -appender.cleanerInfoAppender.layout.type=PatternLayout -appender.cleanerInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.cleanerInfoAppender.policies.type=Policies -appender.cleanerInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.cleanerInfoAppender.policies.time.interval=1 -appender.cleanerInfoAppender.filter.threshold.type=ThresholdFilter -appender.cleanerInfoAppender.filter.threshold.level=INFO - -# Cleaner DEBUG level appender -appender.cleanerDebugAppender.type=RollingFile -appender.cleanerDebugAppender.name=CleanerDebugAppender -appender.cleanerDebugAppender.fileName={{ log_dir }}/debug/log-cleaner.log -appender.cleanerDebugAppender.filePattern={{ log_dir }}/debug/log-cleaner.log.%d{yyyy-MM-dd-HH} -appender.cleanerDebugAppender.layout.type=PatternLayout -appender.cleanerDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.cleanerDebugAppender.policies.type=Policies -appender.cleanerDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.cleanerDebugAppender.policies.time.interval=1 -appender.cleanerDebugAppender.filter.threshold.type=ThresholdFilter -appender.cleanerDebugAppender.filter.threshold.level=DEBUG - -# Controller INFO level appender -appender.controllerInfoAppender.type=RollingFile -appender.controllerInfoAppender.name=ControllerInfoAppender -appender.controllerInfoAppender.fileName={{ log_dir }}/info/controller.log -appender.controllerInfoAppender.filePattern={{ log_dir }}/info/controller.log.%d{yyyy-MM-dd-HH} -appender.controllerInfoAppender.layout.type=PatternLayout -appender.controllerInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.controllerInfoAppender.policies.type=Policies -appender.controllerInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.controllerInfoAppender.policies.time.interval=1 -appender.controllerInfoAppender.filter.threshold.type=ThresholdFilter -appender.controllerInfoAppender.filter.threshold.level=INFO - -# Controller DEBUG level appender -appender.controllerDebugAppender.type=RollingFile -appender.controllerDebugAppender.name=ControllerDebugAppender -appender.controllerDebugAppender.fileName={{ log_dir }}/debug/controller.log -appender.controllerDebugAppender.filePattern={{ log_dir }}/debug/controller.log.%d{yyyy-MM-dd-HH} -appender.controllerDebugAppender.layout.type=PatternLayout -appender.controllerDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.controllerDebugAppender.policies.type=Policies -appender.controllerDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.controllerDebugAppender.policies.time.interval=1 -appender.controllerDebugAppender.filter.threshold.type=ThresholdFilter -appender.controllerDebugAppender.filter.threshold.level=DEBUG - -# Authorizer INFO level appender -appender.authorizerInfoAppender.type=RollingFile -appender.authorizerInfoAppender.name=AuthorizerInfoAppender -appender.authorizerInfoAppender.fileName={{ log_dir }}/info/kafka-authorizer.log -appender.authorizerInfoAppender.filePattern={{ log_dir }}/info/kafka-authorizer.log.%d{yyyy-MM-dd-HH} -appender.authorizerInfoAppender.layout.type=PatternLayout -appender.authorizerInfoAppender.layout.pattern=[%d] %p %m (%c)%n -appender.authorizerInfoAppender.policies.type=Policies -appender.authorizerInfoAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.authorizerInfoAppender.policies.time.interval=1 -appender.authorizerInfoAppender.filter.threshold.type=ThresholdFilter -appender.authorizerInfoAppender.filter.threshold.level=INFO - -# Authorizer DEBUG level appender -appender.authorizerDebugAppender.type=RollingFile -appender.authorizerDebugAppender.name=AuthorizerDebugAppender -appender.authorizerDebugAppender.fileName={{ log_dir }}/debug/kafka-authorizer.log -appender.authorizerDebugAppender.filePattern={{ log_dir }}/debug/kafka-authorizer.log.%d{yyyy-MM-dd-HH} -appender.authorizerDebugAppender.layout.type=PatternLayout -appender.authorizerDebugAppender.layout.pattern=[%d] %p %m (%c)%n -appender.authorizerDebugAppender.policies.type=Policies -appender.authorizerDebugAppender.policies.time.type=TimeBasedTriggeringPolicy -appender.authorizerDebugAppender.policies.time.interval=1 -appender.authorizerDebugAppender.filter.threshold.type=ThresholdFilter -appender.authorizerDebugAppender.filter.threshold.level=DEBUG - -# Root logger configuration -rootLogger.level={{ log_level|default("DEBUG") }} -rootLogger.appenderRefs=stdout -rootLogger.appenderRef.stdout.ref=STDOUT - -# Define loggers for specific packages and components -loggers=kafka.producer.async.DefaultEventHandler,kafka.client.ClientUtils,kafka.perf,kafka.perf.ProducerPerformance$ProducerThread,kafka,kafka.network.RequestChannel$,kafka.network.Processor,kafka.server.KafkaApis,kafka.request.logger,org.apache.kafka.raft,org.apache.kafka.controller,kafka.controller,kafka.log.LogCleaner,state.change.logger,kafka.authorizer.logger,org.apache.kafka.coordinator.group - -# Kafka loggers -logger.kafka.producer.async.DefaultEventHandler.name=kafka.producer.async.DefaultEventHandler -logger.kafka.producer.async.DefaultEventHandler.level={{ log_level|default("DEBUG") }} -logger.kafka.producer.async.DefaultEventHandler.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.kafka.producer.async.DefaultEventHandler.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.kafka.producer.async.DefaultEventHandler.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender - -logger.kafka.client.ClientUtils.name=kafka.client.ClientUtils -logger.kafka.client.ClientUtils.level={{ log_level|default("DEBUG") }} -logger.kafka.client.ClientUtils.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.kafka.client.ClientUtils.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.kafka.client.ClientUtils.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender - -logger.kafka.perf.name=kafka.perf -logger.kafka.perf.level={{ log_level|default("DEBUG") }} -logger.kafka.perf.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.kafka.perf.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.kafka.perf.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender - -logger.kafka.perf.ProducerPerformance$ProducerThread.name=kafka.perf.ProducerPerformance$ProducerThread -logger.kafka.perf.ProducerPerformance$ProducerThread.level={{ log_level|default("DEBUG") }} -logger.kafka.perf.ProducerPerformance$ProducerThread.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.kafka.perf.ProducerPerformance$ProducerThread.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.kafka.perf.ProducerPerformance$ProducerThread.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender - -logger.kafka.name=kafka -logger.kafka.level={{ log_level|default("DEBUG") }} -logger.kafka.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.kafka.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.kafka.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender - -# Request Channel and Server loggers -logger.kafka.network.RequestChannel$.name=kafka.network.RequestChannel$ -logger.kafka.network.RequestChannel$.level={{ log_level|default("DEBUG") }} -logger.kafka.network.RequestChannel$.appenderRefs=requestInfoAppender,requestDebugAppender -logger.kafka.network.RequestChannel$.appenderRef.requestInfoAppender.ref=RequestInfoAppender -logger.kafka.network.RequestChannel$.appenderRef.requestDebugAppender.ref=RequestDebugAppender -logger.kafka.network.RequestChannel$.additivity=false - -logger.kafka.network.Processor.name=kafka.network.Processor -logger.kafka.network.Processor.level={{ log_level|default("DEBUG") }} -logger.kafka.network.Processor.appenderRefs=requestInfoAppender,requestDebugAppender -logger.kafka.network.Processor.appenderRef.requestInfoAppender.ref=RequestInfoAppender -logger.kafka.network.Processor.appenderRef.requestDebugAppender.ref=RequestDebugAppender - -logger.kafka.server.KafkaApis.name=kafka.server.KafkaApis -logger.kafka.server.KafkaApis.level={{ log_level|default("DEBUG") }} -logger.kafka.server.KafkaApis.appenderRefs=requestInfoAppender,requestDebugAppender -logger.kafka.server.KafkaApis.appenderRef.requestInfoAppender.ref=RequestInfoAppender -logger.kafka.server.KafkaApis.appenderRef.requestDebugAppender.ref=RequestDebugAppender -logger.kafka.server.KafkaApis.additivity=false - -logger.kafka.request.logger.name=kafka.request.logger -logger.kafka.request.logger.level={{ log_level|default("DEBUG") }} -logger.kafka.request.logger.appenderRefs=requestInfoAppender,requestDebugAppender -logger.kafka.request.logger.appenderRef.requestInfoAppender.ref=RequestInfoAppender -logger.kafka.request.logger.appenderRef.requestDebugAppender.ref=RequestDebugAppender -logger.kafka.request.logger.additivity=false - -# Controller loggers -logger.org.apache.kafka.raft.name=org.apache.kafka.raft -logger.org.apache.kafka.raft.level={{ log_level|default("DEBUG") }} -logger.org.apache.kafka.raft.appenderRefs=controllerInfoAppender,controllerDebugAppender -logger.org.apache.kafka.raft.appenderRef.controllerInfoAppender.ref=ControllerInfoAppender -logger.org.apache.kafka.raft.appenderRef.controllerDebugAppender.ref=ControllerDebugAppender - -logger.org.apache.kafka.controller.name=org.apache.kafka.controller -logger.org.apache.kafka.controller.level={{ log_level|default("DEBUG") }} -logger.org.apache.kafka.controller.appenderRefs=controllerInfoAppender,controllerDebugAppender -logger.org.apache.kafka.controller.appenderRef.controllerInfoAppender.ref=ControllerInfoAppender -logger.org.apache.kafka.controller.appenderRef.controllerDebugAppender.ref=ControllerDebugAppender - -logger.kafka.controller.name=kafka.controller -logger.kafka.controller.level={{ log_level|default("DEBUG") }} -logger.kafka.controller.appenderRefs=controllerInfoAppender,controllerDebugAppender -logger.kafka.controller.appenderRef.controllerInfoAppender.ref=ControllerInfoAppender -logger.kafka.controller.appenderRef.controllerDebugAppender.ref=ControllerDebugAppender -logger.kafka.controller.additivity=false - -# Log Cleaner logger -logger.kafka.log.LogCleaner.name=kafka.log.LogCleaner -logger.kafka.log.LogCleaner.level={{ log_level|default("DEBUG") }} -logger.kafka.log.LogCleaner.appenderRefs=cleanerInfoAppender,cleanerDebugAppender -logger.kafka.log.LogCleaner.appenderRef.cleanerInfoAppender.ref=CleanerInfoAppender -logger.kafka.log.LogCleaner.appenderRef.cleanerDebugAppender.ref=CleanerDebugAppender -logger.kafka.log.LogCleaner.additivity=false - -# State change logger -logger.state.change.logger.name=state.change.logger -logger.state.change.logger.level={{ log_level|default("DEBUG") }} -logger.state.change.logger.appenderRefs=stateChangeInfoAppender,stateChangeDebugAppender -logger.state.change.logger.appenderRef.stateChangeInfoAppender.ref=StateChangeInfoAppender -logger.state.change.logger.appenderRef.stateChangeDebugAppender.ref=StateChangeDebugAppender -logger.state.change.logger.additivity=false - -# Authorizer logger -logger.kafka.authorizer.logger.name=kafka.authorizer.logger -logger.kafka.authorizer.logger.level={{ log_level|default("DEBUG") }} -logger.kafka.authorizer.logger.appenderRefs=authorizerInfoAppender,authorizerDebugAppender -logger.kafka.authorizer.logger.appenderRef.authorizerInfoAppender.ref=AuthorizerInfoAppender -logger.kafka.authorizer.logger.appenderRef.authorizerDebugAppender.ref=AuthorizerDebugAppender -logger.kafka.authorizer.logger.additivity=false - -# Coordinator logger -logger.org.apache.kafka.coordinator.group.name=org.apache.kafka.coordinator.group -logger.org.apache.kafka.coordinator.group.level={{ log_level|default("DEBUG") }} -logger.org.apache.kafka.coordinator.group.appenderRefs=kafkaInfoAppender,kafkaDebugAppender -logger.org.apache.kafka.coordinator.group.appenderRef.kafkaInfoAppender.ref=KafkaInfoAppender -logger.org.apache.kafka.coordinator.group.appenderRef.kafkaDebugAppender.ref=KafkaDebugAppender -logger.org.apache.kafka.coordinator.group.additivity=false diff --git a/tests/kafkatest/services/kafka/templates/log4j2.yaml b/tests/kafkatest/services/kafka/templates/log4j2.yaml new file mode 100644 index 000000000000..d3aad72df956 --- /dev/null +++ b/tests/kafkatest/services/kafka/templates/log4j2.yaml @@ -0,0 +1,289 @@ +# 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: + Properties: + Property: + - name: "log_dir" + value: "/var/log/kafka" + - name: "log_level" + value: "DEBUG" + - name: "logPattern" + value: "[%d] %p %m (%c)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + RollingFile: + - name: KafkaInfoAppender + fileName: "${sys:log_dir}/info/server.log" + filePattern: "${sys:log_dir}/info/server.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: KafkaDebugAppender + fileName: "${sys:log_dir}/debug/server.log" + filePattern: "${sys:log_dir}/debug/server.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + - name: StateChangeInfoAppender + fileName: "${sys:log_dir}/info/state-change.log" + filePattern: "${sys:log_dir}/info/state-change.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: StateChangeDebugAppender + fileName: "${sys:log_dir}/debug/state-change.log" + filePattern: "${sys:log_dir}/debug/state-change.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + - name: RequestInfoAppender + fileName: "${sys:log_dir}/info/kafka-request.log" + filePattern: "${sys:log_dir}/info/kafka-request.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: RequestDebugAppender + fileName: "${sys:log_dir}/debug/kafka-request.log" + filePattern: "${sys:log_dir}/debug/kafka-request.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + - name: CleanerInfoAppender + fileName: "${sys:log_dir}/info/log-cleaner.log" + filePattern: "${sys:log_dir}/info/log-cleaner.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: CleanerDebugAppender + fileName: "${sys:log_dir}/debug/log-cleaner.log" + filePattern: "${sys:log_dir}/debug/log-cleaner.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + - name: ControllerInfoAppender + fileName: "${sys:log_dir}/info/controller.log" + filePattern: "${sys:log_dir}/info/controller.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: ControllerDebugAppender + fileName: "${sys:log_dir}/debug/controller.log" + filePattern: "${sys:log_dir}/debug/controller.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + - name: AuthorizerInfoAppender + fileName: "${sys:log_dir}/info/kafka-authorizer.log" + filePattern: "${sys:log_dir}/info/kafka-authorizer.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: INFO + + - name: AuthorizerDebugAppender + fileName: "${sys:log_dir}/debug/kafka-authorizer.log" + filePattern: "${sys:log_dir}/debug/kafka-authorizer.log.%d{yyyy-MM-dd-HH}" + PatternLayout: + pattern: "${logPattern}" + Policies: + TimeBasedTriggeringPolicy: + interval: 1 + Filters: + ThresholdFilter: + level: DEBUG + + Loggers: + Root: + level: "${sys:log_level}" + AppenderRef: + - ref: STDOUT + + Logger: + - name: kafka.producer.async.DefaultEventHandler + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender + + - name: kafka.client.ClientUtils + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender + + - name: kafka.perf + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender + + - name: kafka.perf.ProducerPerformance$ProducerThread + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender + + - name: kafka + level: "${sys:log_level}" + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender + + - name: kafka.network.RequestChannel$ + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: RequestInfoAppender + - ref: RequestDebugAppender + + - name: kafka.network.Processor + level: "${sys:log_level}" + AppenderRef: + - ref: RequestInfoAppender + - ref: RequestDebugAppender + + - name: kafka.server.KafkaApis + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: RequestInfoAppender + - ref: RequestDebugAppender + + - name: kafka.request.logger + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: RequestInfoAppender + - ref: RequestDebugAppender + + - name: org.apache.kafka.raft + level: "${sys:log_level}" + AppenderRef: + - ref: ControllerInfoAppender + - ref: ControllerDebugAppender + + - name: org.apache.kafka.controller + level: "${sys:log_level}" + AppenderRef: + - ref: ControllerInfoAppender + - ref: ControllerDebugAppender + + - name: kafka.controller + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: ControllerInfoAppender + - ref: ControllerDebugAppender + + - name: kafka.log.LogCleaner + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: CleanerInfoAppender + - ref: CleanerDebugAppender + + - name: state.change.logger + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: StateChangeInfoAppender + - ref: StateChangeDebugAppender + + - name: kafka.authorizer.logger + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: AuthorizerInfoAppender + - ref: AuthorizerDebugAppender + + - name: org.apache.kafka.coordinator.group + level: "${sys:log_level}" + additivity: false + AppenderRef: + - ref: KafkaInfoAppender + - ref: KafkaDebugAppender diff --git a/tests/kafkatest/services/templates/connect_log4j2.yaml b/tests/kafkatest/services/templates/connect_log4j2.yaml new file mode 100644 index 000000000000..873fbd31ece6 --- /dev/null +++ b/tests/kafkatest/services/templates/connect_log4j2.yaml @@ -0,0 +1,43 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + RollingFile: + - name: FILE + fileName: {{ log_file }} + append: true + immediateFlush: true + PatternLayout: + pattern: "${logPattern}" + TimeBasedTriggeringPolicy: + modulate: true + interval: 1 + + Loggers: + Root: + level: {{ log_level|default("INFO") }} + AppenderRef: + - ref: FILE diff --git a/tests/kafkatest/services/templates/tools_log4j2.properties b/tests/kafkatest/services/templates/tools_log4j2.properties deleted file mode 100644 index e906667582fc..000000000000 --- a/tests/kafkatest/services/templates/tools_log4j2.properties +++ /dev/null @@ -1,38 +0,0 @@ -# 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. - -# Define the root logger with appender file -name=KafkaTestsTemplatesToolConfig - -appenders=file - -appender.file.type=File -appender.file.name=FILE -appender.file.fileName={{ log_file }} -appender.file.append=true -appender.file.immediateFlush=true -appender.file.layout.type=PatternLayout -appender.file.layout.pattern=[%d] %p %m (%c)%n - -rootLogger.level={{ log_level|default("INFO") }} -rootLogger.appenderRefs=file -rootLogger.appenderRef.file.ref=FILE - -{% if loggers is defined %} -{% for logger, log_level in loggers.items() %} -logger.{{ logger }}.name={{ logger }} -logger.{{ logger }}.level={{ log_level }} -{% endfor %} -{% endif %} diff --git a/core/src/test/resources/log4j2.properties b/tests/kafkatest/services/templates/tools_log4j2.yaml similarity index 50% rename from core/src/test/resources/log4j2.properties rename to tests/kafkatest/services/templates/tools_log4j2.yaml index 18f04dd60047..081c0b53a282 100644 --- a/core/src/test/resources/log4j2.properties +++ b/tests/kafkatest/services/templates/tools_log4j2.yaml @@ -1,9 +1,9 @@ # Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with +# 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 +# the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # @@ -12,25 +12,28 @@ # 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. -# Root logger configuration -name=TestConfig -# Appender configuration -appender=console -appender.console.type=Console -appender.console.name=STDOUT -appender.console.layout.type=PatternLayout -appender.console.layout.pattern=[%d] %p %m (%c:%L)%n +Configuration: + Appenders: + File: + name: FILE + fileName: {{ log_file }} + append: true + immediateFlush: true + PatternLayout: + pattern: "[%d] %p %m (%c)%n" -rootLogger.level=OFF -rootLogger.appenderRefs=console -rootLogger.appenderRef.console.ref=STDOUT + Loggers: + Root: + level: {{ log_level|default("INFO") }} + AppenderRef: + - ref: FILE -loggers=kafka,apacheKafka - -# Logger configurations -logger.kafka.name=kafka -logger.kafka.level=WARN - -logger.apacheKafka.name=org.apache.kafka -logger.apacheKafka.level=WARN + Logger: + # Add additional loggers dynamically if defined + {% if loggers is defined %} + {% for logger, log_level in loggers.items() %} +- name: {{ logger }} + level: {{ log_level }} + {% endfor %} + {% endif %} \ No newline at end of file diff --git a/tests/kafkatest/services/trogdor/templates/log4j2.properties b/tests/kafkatest/services/trogdor/templates/log4j2.properties deleted file mode 100644 index c9978b28e3ac..000000000000 --- a/tests/kafkatest/services/trogdor/templates/log4j2.properties +++ /dev/null @@ -1,45 +0,0 @@ -# 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. - -name=KafkaTestsTrogdorConfig -appenders=mylogger - -appender.mylogger.type=File -appender.mylogger.name=MyFileLogger -appender.mylogger.fileName={{ log_path }} -appender.mylogger.layout.type=PatternLayout -appender.mylogger.layout.pattern=[%d] %p %m (%c)%n - -rootLogger.level=DEBUG -rootLogger.appenderRefs=mylogger -rootLogger.appenderRef.mylogger.ref=MyFileLogger - -logger.kafka.name=kafka -logger.kafka.level=DEBUG -logger.kafka.additivity=false -logger.kafka.appenderRefs=mylogger -logger.kafka.appenderRef.mylogger.ref=MyFileLogger - -logger.org.apache.kafka.name=org.apache.kafka -logger.org.apache.kafka.level=DEBUG -logger.org.apache.kafka.additivity=false -logger.org.apache.kafka.appenderRefs=mylogger -logger.org.apache.kafka.appenderRef.mylogger.ref=MyFileLogger - -logger.org.eclipse.name=org.eclipse -logger.org.eclipse.level=INFO -logger.org.eclipse.additivity=false -logger.org.eclipse.appenderRefs=mylogger -logger.org.eclipse.appenderRef.mylogger.ref=MyFileLogger diff --git a/tests/kafkatest/services/trogdor/templates/log4j2.yaml b/tests/kafkatest/services/trogdor/templates/log4j2.yaml new file mode 100644 index 000000000000..b6367ff2774a --- /dev/null +++ b/tests/kafkatest/services/trogdor/templates/log4j2.yaml @@ -0,0 +1,56 @@ +# 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: + Properties: + Property: + - name: "logPattern" + value: "[%d] %p %m (%c)%n" + + Appenders: + Console: + name: STDOUT + PatternLayout: + pattern: "${logPattern}" + + RollingFile: + - name: FILE + fileName: {{ log_file }} + filePattern: "${sys:kafka.logs.dir}/connect-%d{yyyy-MM-dd-HH}.log" + PatternLayout: + pattern: "${logPattern}" + Loggers: + Root: + level: DEBUG + AppenderRef: + - ref: MyFileLogger + Logger: + - name: kafka + level: DEBUG + additivity: false + AppenderRef: + - ref: MyFileLogger + + - name: org.apache.kafka + level: DEBUG + additivity: false + AppenderRef: + - ref: MyFileLogger + + - name: org.eclipse + level: DEBUG + additivity: false + AppenderRef: + - ref: MyFileLogger diff --git a/tests/kafkatest/tests/streams/templates/log4j2_template.properties b/tests/kafkatest/tests/streams/templates/log4j2_template.properties deleted file mode 100644 index 45dbbf0502c0..000000000000 --- a/tests/kafkatest/tests/streams/templates/log4j2_template.properties +++ /dev/null @@ -1,38 +0,0 @@ -# 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. - -# Define the root logger with appender file -name=KafkaTestsStreamsTemplateConfig - -appenders=file - -appender.file.type=File -appender.file.name=FILE -appender.file.fileName={{ log_file }} -appender.file.append=true -appender.file.immediateFlush=true -appender.file.layout.type=PatternLayout -appender.file.layout.pattern=[%d] %p %m (%c)%n - -rootLogger.level={{ log_level|default("INFO") }} -rootLogger.appenderRefs=file -rootLogger.appenderRef.file.ref=FILE - -{% if loggers is defined %} -{% for logger, log_level in loggers.items() %} -logger.{{ logger }}.name={{ logger }} -logger.{{ logger }}.level={{ log_level }} -{% endfor %} -{% endif %} diff --git a/tests/kafkatest/services/templates/connect_log4j2.properties b/tests/kafkatest/tests/streams/templates/log4j2_template.yaml similarity index 60% rename from tests/kafkatest/services/templates/connect_log4j2.properties rename to tests/kafkatest/tests/streams/templates/log4j2_template.yaml index 2dd5ec2696bc..757a4ec4421b 100644 --- a/tests/kafkatest/services/templates/connect_log4j2.properties +++ b/tests/kafkatest/tests/streams/templates/log4j2_template.yaml @@ -1,4 +1,3 @@ -## # 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. @@ -13,21 +12,29 @@ # 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. -## # Define the root logger with appender file -name=TestsTemplatesConnectConfig +Configuration: + Appenders: + File: + name: FILE + fileName: {{ log_file }} + append: true + immediateFlush: true + PatternLayout: + pattern: "[%d] %p %m (%c)%n" -appenders=file + Loggers: + Root: + level: {{ log_level|default("INFO") }} + AppenderRef: + - ref: FILE -appender.file.type=File -appender.file.name=FILE -appender.file.fileName={{ log_file }} -appender.file.append=true -appender.file.immediateFlush=true -appender.file.layout.type=PatternLayout -appender.file.layout.pattern=[%d] %p %m (%c)%n - -rootLogger.level={{ log_level|default("INFO") }} -rootLogger.appenderRefs=file -rootLogger.appenderRef.file.ref=FILE + Logger: + # 動態生成的 Logger 區域 + {% if loggers is defined %} + {% for logger, log_level in loggers.items() %} + - name: {{ logger }} + level: {{ log_level }} + {% endfor %} + {% endif %} \ No newline at end of file