Repository: kafka Updated Branches: refs/heads/trunk 8cdb234ad -> 220cc842a
kafka-1285; enable log4j in unit test; patched by Jun Rao; reviewed by Neha Narkhede Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/220cc842 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/220cc842 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/220cc842 Branch: refs/heads/trunk Commit: 220cc842a6e866806e3f53c394b5547fe7c44b3e Parents: 8cdb234 Author: Jun Rao <jun...@gmail.com> Authored: Fri Feb 28 13:53:37 2014 -0800 Committer: Jun Rao <jun...@gmail.com> Committed: Fri Feb 28 13:53:37 2014 -0800 ---------------------------------------------------------------------- README.md | 4 ++++ build.gradle | 4 ++++ clients/src/test/resources/log4j.properties | 21 +++++++++++++++++++++ core/src/test/resources/log4j.properties | 1 + 4 files changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/220cc842/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index d0cdde9..aa84790 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Follow instuctions in http://kafka.apache.org/documentation.html#quickstart ### Running a particular unit test ### ./gradlew -Dtest.single=RequestResponseSerializationTest core:test +### Running a particular unit test with log4j output ### + change the log4j setting in either clients/src/test/resources/log4j.properties or core/src/test/resources/log4j.properties + ./gradlew -i -Dtest.single=RequestResponseSerializationTest core:test + ### Building a binary release gzipped tar ball ### ./gradlew clean ./gradlew releaseTarGz http://git-wip-us.apache.org/repos/asf/kafka/blob/220cc842/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 29b1e0f..36ea2b7 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,8 @@ buildscript { apply from: file('gradle/buildscript.gradle'), to: buildscript } +slf4jlog4j='org.slf4j:slf4j-log4j12:1.7.6' + allprojects { apply plugin: 'idea' repositories { @@ -163,6 +165,7 @@ project(':core') { } else { testCompile "org.scalatest:scalatest_$scalaVersion:1.8" } + testRuntime "$slf4jlog4j" zinc 'com.typesafe.zinc:zinc:0.2.5' } @@ -312,6 +315,7 @@ project(':clients') { dependencies { compile "org.slf4j:slf4j-api:1.7.6" testCompile 'com.novocode:junit-interface:0.9' + testRuntime "$slf4jlog4j" } jar { http://git-wip-us.apache.org/repos/asf/kafka/blob/220cc842/clients/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/clients/src/test/resources/log4j.properties b/clients/src/test/resources/log4j.properties new file mode 100644 index 0000000..b1d5b7f --- /dev/null +++ b/clients/src/test/resources/log4j.properties @@ -0,0 +1,21 @@ +# 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. +log4j.rootLogger=OFF, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n + +log4j.logger.org.apache.kafka=ERROR http://git-wip-us.apache.org/repos/asf/kafka/blob/220cc842/core/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/core/src/test/resources/log4j.properties b/core/src/test/resources/log4j.properties index d7d03ea..1b7d5d8 100644 --- a/core/src/test/resources/log4j.properties +++ b/core/src/test/resources/log4j.properties @@ -19,6 +19,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n log4j.logger.kafka=ERROR +log4j.logger.org.apache.kafka=ERROR # zkclient can be verbose, during debugging it is common to adjust is separately log4j.logger.org.I0Itec.zkclient.ZkClient=WARN