Revert "SAMZA-2155: Remove log4j log4j2 dependency from samza-test"
This reverts commit f260be6be5bb184073a2187edc5898b6cba7dea1.
diff --git a/build.gradle b/build.gradle
index 845b316..8a78ab6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -842,9 +842,6 @@
compile.exclude group: 'javax.jms', module: 'jms'
compile.exclude group: 'com.sun.jdmk', module: 'jmxtools'
compile.exclude group: 'com.sun.jmx', module: 'jmxri'
- // Exclude Slf4j bindings for log4j1 and log4j2 since samza-test just logs to console using slf4j-simple
- compile.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
- compile.exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
}
dependencies {
@@ -855,6 +852,8 @@
compile project(":samza-core_$scalaSuffix")
compile project(":samza-kafka_$scalaSuffix")
compile project(":samza-sql_$scalaSuffix")
+ runtime project(":samza-log4j_$scalaSuffix")
+ runtime project(":samza-log4j2_$scalaSuffix")
runtime project(":samza-yarn_$scalaSuffix")
runtime project(":samza-hdfs_$scalaSuffix")
compile "org.scala-lang:scala-library:$scalaVersion"
diff --git a/samza-test/src/main/resources/log4j.xml b/samza-test/src/main/resources/log4j.xml
index 12f752c..a444f1d 100644
--- a/samza-test/src/main/resources/log4j.xml
+++ b/samza-test/src/main/resources/log4j.xml
@@ -1,27 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
+<!-- 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. -->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] [%X{REQUEST_UUID}] %c{1} [%p] %m%n" />
+ <param name="ConversionPattern" value="[%t] %c{1} [%p] %m%n" />
</layout>
</appender>
- <logger name="kafka">
- <level value="off" />
+ <root>
+ <priority value="info" />
+ <appender-ref ref="console" />
+ </root>
+
+ <logger name="STARTUP_LOGGER" additivity="false">
+ <level value="info" />
+ <appender-ref ref="console"/>
</logger>
- <logger name="org.apache.kafka">
- <level value="off" />
+
+ <logger name="org.apache.hadoop">
+ <level value="ERROR"/>
</logger>
- <logger name="org.apache.samza.system.kafka">
- <level value="off" />
+ <logger name="org.I0Itec.zkclient">
+ <level value="ERROR"/>
</logger>
<logger name="org.apache.zookeeper">
- <level value="off" />
+ <level value="ERROR"/>
</logger>
- <root>
- <priority value="INFO" />
- <appender-ref ref="console"/>
- </root>
+ <logger name="org.apache.samza.system.kafka">
+ <level value="ERROR"/>
+ </logger>
+ <logger name="org.apache.kafka">
+ <level value="ERROR"/>
+ </logger>
+ <logger name="kafka">
+ <level value="ERROR"/>
+ </logger>
</log4j:configuration>
diff --git a/samza-test/src/main/resources/log4j2.xml b/samza-test/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..f00cb7d
--- /dev/null
+++ b/samza-test/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- 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>
+ <Appenders>
+ <Console name="STDOUT" target="SYSTEM_OUT">
+ <PatternLayout pattern="[%t] %c{1} [%p] %m%n"/>
+ </Console>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="STDOUT"/>
+ </Root>
+
+ <Logger name="STARTUP_LOGGER" level="info" additivity="false">
+ <AppenderRef ref="STDOUT"/>
+ </Logger>
+
+ <Logger name="org.apache.hadoop" level="error"></Logger>
+
+ <Logger name="org.I0Itec.zkclient" level="error"></Logger>
+
+ <Logger name="org.apache.zookeeper" level="error"></Logger>
+
+ <Logger name="org.apache.samza.system.kafka" level="error"></Logger>
+
+ <Logger name="org.apache.kafka" level="error"></Logger>
+
+ <Logger name="kafka" level="error"></Logger>
+
+ </Loggers>
+</Configuration>
\ No newline at end of file