This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
     new 2280879  [CALCITE-4858] Use Log4j2 instead of unsupported Log4j (1.x) 
in tests
2280879 is described below

commit 2280879f38c8347801749998f2801aaf7364c6f0
Author: Stamatis Zampetakis <zabe...@gmail.com>
AuthorDate: Fri Oct 15 17:15:31 2021 +0200

    [CALCITE-4858] Use Log4j2 instead of unsupported Log4j (1.x) in tests
    
    1. Replace slf4j-log4j12 dependency (using Log4j 1.x)  with
    log4j-slf4j-impl (using Log4j 2.x) when possible. Cannot remove
    Log4j 1.x from Pig/Piglet modules due to compilation dependency of the
    latter directly to log4j.
    2. Use XML syntax instead of property syntax for Log4j configuration. A
    Log4j configuration is hierarchical by nature so formats with natural
    support for nesting (such as XML) are easier to use.
    3. Exclude slf4j-log4j12 when it comes transitively from other
    dependencies. It gets in conflict with log4j-slf4j-impl and it may also
    appear transitively in projects using Calcite.
    4. Add log4j-slf4j-impl in modules (kafka, mongodb, plus, example) to
    silence error messages due to missing logger implementation.
    5. Always use testRuntimeOnly annotation for dependencies on SLF4J
    logger implementation. Calcite shouldn't enforce a specific logger
    implementation so they should never appear as compile or runtime
    dependencies. A concrete implementation is only needed when we want to
    log messages for testing purposes.
    6. Bump Cassandra version to 3.11.3 to use Log4j2 in tests. Previous
    versions did not allow the use of any custom logger implementation
    (only logback). This was resolved CASSANDRA-13396 so now we can use
    Log4j2 as the rest of the tests.
    7. Unify display pattern in elasticsearch log4j2.xml with the rest of
    tests.
    8. Add/Modify Log4j2 configuration (log4j2-test.xml) to silence errors
    and not display logging messages in tests. Instead of globally turning
    off logs, specific logger entries were set in the configuration files:
    (i) to avoid hiding by accident important problems;
    (ii) to faciliate switching log levels during debugging in the future.
    
    Close apache/calcite#2587
---
 babel/build.gradle.kts                             |  3 ++-
 bom/build.gradle.kts                               |  5 +++-
 cassandra/build.gradle.kts                         | 12 ++++++++-
 .../src/test/resources/log4j2-test.xml             | 15 ++++++-----
 core/build.gradle.kts                              |  7 +++--
 core/src/test/resources/log4j.properties           | 31 ----------------------
 .../src/test/resources/log4j2-test.xml             | 21 ++++++++++-----
 druid/build.gradle.kts                             |  2 +-
 druid/src/test/resources/log4j.properties          | 30 ---------------------
 .../src/test/resources/log4j2-test.xml             | 12 ++++-----
 .../test/resources/{log4j2.xml => log4j2-test.xml} | 12 ++++-----
 example/csv/build.gradle.kts                       |  2 ++
 example/function/build.gradle.kts                  |  1 +
 file/build.gradle.kts                              |  1 +
 geode/build.gradle.kts                             |  2 +-
 geode/src/test/resources/log4j.properties          | 28 -------------------
 .../src/test/resources/log4j2-test.xml             | 16 ++++++-----
 gradle.properties                                  |  2 +-
 innodb/build.gradle.kts                            |  7 +++--
 .../src/test/resources/log4j2-test.xml             | 12 ++++-----
 kafka/build.gradle.kts                             |  1 +
 .../src/test/resources/log4j2-test.xml             | 12 ++++-----
 mongodb/build.gradle.kts                           |  1 +
 mongodb/src/test/resources/log4j.properties        | 26 ------------------
 .../src/test/resources/log4j2-test.xml             | 16 ++++++-----
 plus/build.gradle.kts                              |  1 +
 .../src/test/resources/log4j2-test.xml             | 31 +++++++++++-----------
 redis/build.gradle.kts                             |  2 +-
 .../src/test/resources/log4j2-test.xml             | 15 ++++++-----
 server/build.gradle.kts                            |  2 +-
 .../src/test/resources/log4j2-test.xml             | 14 +++++-----
 spark/build.gradle.kts                             |  6 ++++-
 spark/src/test/resources/log4j.properties          | 29 --------------------
 .../src/test/resources/log4j2-test.xml             | 16 ++++++-----
 splunk/build.gradle.kts                            |  2 +-
 splunk/src/test/resources/log4j.properties         | 26 ------------------
 .../src/test/resources/log4j2-test.xml             | 13 ++++-----
 37 files changed, 162 insertions(+), 272 deletions(-)

diff --git a/babel/build.gradle.kts b/babel/build.gradle.kts
index 8b689d1..0a5d8dd 100644
--- a/babel/build.gradle.kts
+++ b/babel/build.gradle.kts
@@ -31,8 +31,9 @@ dependencies {
     testImplementation("net.hydromatic:scott-data-hsqldb")
     testImplementation("org.hsqldb:hsqldb")
     testImplementation("org.incava:java-diff")
-    testImplementation("org.slf4j:slf4j-log4j12")
     testImplementation(project(":testkit"))
+
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 val fmppMain by 
tasks.registering(org.apache.calcite.buildtools.fmpp.FmppTask::class) {
diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts
index 88b741d..fc949ef 100644
--- a/bom/build.gradle.kts
+++ b/bom/build.gradle.kts
@@ -147,7 +147,10 @@ dependencies {
         apiv("org.postgresql:postgresql")
         apiv("org.scala-lang:scala-library")
         apiv("org.slf4j:slf4j-api", "slf4j")
-        apiv("org.slf4j:slf4j-log4j12", "slf4j")
+        // TODO: https://issues.apache.org/jira/browse/CALCITE-4862
+        // Eventually we should get rid of slf4j-log4j12 dependency but 
currently it is not possible
+        // since certain modules (Pig, Piglet) have dependencies using 
directly Log4j 1.x APIs
+        runtimev("org.slf4j:slf4j-log4j12", "slf4j")
         apiv("org.testcontainers:testcontainers")
         apiv("redis.clients:jedis")
         apiv("sqlline:sqlline")
diff --git a/cassandra/build.gradle.kts b/cassandra/build.gradle.kts
index b9fc9cc..2787aaf 100644
--- a/cassandra/build.gradle.kts
+++ b/cassandra/build.gradle.kts
@@ -35,13 +35,23 @@ dependencies {
     testImplementation("org.apache.cassandra:cassandra-all") {
         exclude("org.slf4j", "log4j-over-slf4j")
             .because("log4j is already present in the classpath")
+        exclude("ch.qos.logback", "logback-core")
+            .because("conflicts with log4j-slf4j-impl")
+        exclude("ch.qos.logback", "logback-classic")
+            .because("conflicts with log4j-slf4j-impl")
+    }
+    testImplementation("org.cassandraunit:cassandra-unit") {
+        exclude("ch.qos.logback", "logback-core")
+            .because("conflicts with log4j-slf4j-impl")
+        exclude("ch.qos.logback", "logback-classic")
+            .because("conflicts with log4j-slf4j-impl")
     }
-    testImplementation("org.cassandraunit:cassandra-unit")
     testRuntimeOnly("net.java.dev.jna:jna")
 
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 fun JavaCompile.configureAnnotationSet(sourceSet: SourceSet) {
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/cassandra/src/test/resources/log4j2-test.xml
similarity index 70%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to cassandra/src/test/resources/log4j2-test.xml
index 506bef0..514960a 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/cassandra/src/test/resources/log4j2-test.xml
@@ -15,18 +15,21 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <logger name="org.apache.cassandra" level="off"/>
+    <logger name="com.datastax" level="WARN"/>
+    <!-- Avoid showing connection errors on cassandra shutdown -->
+    <logger name="com.datastax.driver.core.ControlConnection" level="off"/>
   </Loggers>
 </Configuration>
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index 2446071..c064929 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -53,7 +53,10 @@ dependencies {
     implementation("com.fasterxml.jackson.core:jackson-core")
     implementation("com.fasterxml.jackson.core:jackson-databind")
     implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
-    implementation("com.google.uzaygezen:uzaygezen-core")
+    implementation("com.google.uzaygezen:uzaygezen-core") {
+        exclude("log4j", "log4j").because("conflicts with log4j-slf4j-impl 
which uses log4j2 and" +
+                " also leaks transitively to projects depending on 
calcite-core")
+    }
     implementation("com.jayway.jsonpath:json-path")
     implementation("com.yahoo.datasketches:sketches-core")
     implementation("commons-codec:commons-codec")
@@ -86,7 +89,7 @@ dependencies {
     testImplementation(kotlin("stdlib-jdk8"))
     testImplementation(kotlin("test"))
     testImplementation(kotlin("test-junit5"))
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 tasks.jar {
diff --git a/core/src/test/resources/log4j.properties 
b/core/src/test/resources/log4j.properties
deleted file mode 100644
index 1870019..0000000
--- a/core/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,31 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# [CALCITE-2519] Silence ERROR logs from CalciteException, 
SqlValidatorException during tests
-log4j.logger.org.apache.calcite.runtime.CalciteException=FATAL
-log4j.logger.org.apache.calcite.sql.validate.SqlValidatorException=FATAL
-log4j.logger.org.apache.calcite.plan.RexImplicationChecker=ERROR
-log4j.logger.org.apache.calcite.sql.test.SqlOperatorBaseTest=FATAL
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/core/src/test/resources/log4j2-test.xml
similarity index 51%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to core/src/test/resources/log4j2-test.xml
index 506bef0..c620c0f 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/core/src/test/resources/log4j2-test.xml
@@ -15,18 +15,27 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <!-- [CALCITE-2519] Silence ERROR logs from CalciteException, 
SqlValidatorException during tests -->
+    <logger name="org.apache.calcite.runtime.CalciteException" level="FATAL"/>
+    <logger name="org.apache.calcite.sql.validate.SqlValidatorException" 
level="ERROR"/>
+    <logger name="org.apache.calcite.plan.RexImplicationChecker" 
level="FATAL"/>
+    <logger name="org.apache.calcite.sql.test.SqlOperatorBaseTest" 
level="FATAL"/>
+    <!-- [CALCITE-4858] Silence anything but errors -->
+    <logger name="org.apache.calcite.plan.VisitorDataContext" level="ERROR"/>
+    <logger name="org.apache.calcite.avatica" level="ERROR"/>
+    <logger name="org.eclipse.jetty" level="ERROR"/>
+    <logger name="org.apache.calcite.sql.parser" level="ERROR"/>
   </Loggers>
 </Configuration>
diff --git a/druid/build.gradle.kts b/druid/build.gradle.kts
index caaa8e7..1b1fcf7 100644
--- a/druid/build.gradle.kts
+++ b/druid/build.gradle.kts
@@ -36,7 +36,7 @@ dependencies {
 
     testImplementation(project(":testkit"))
     testImplementation("org.mockito:mockito-core")
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
diff --git a/druid/src/test/resources/log4j.properties 
b/druid/src/test/resources/log4j.properties
deleted file mode 100644
index a8883a5..0000000
--- a/druid/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,30 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Uncomment to send output to a file.
-#log4j.appender.A1=org.apache.log4j.RollingFileAppender
-#log4j.appender.A1.File=/tmp/trace.log
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/druid/src/test/resources/log4j2-test.xml
similarity index 77%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to druid/src/test/resources/log4j2-test.xml
index 506bef0..320cb94 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/druid/src/test/resources/log4j2-test.xml
@@ -15,18 +15,18 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <logger name="org.apache.calcite.adapter.druid" level="ERROR"/>
   </Loggers>
 </Configuration>
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/elasticsearch/src/test/resources/log4j2-test.xml
similarity index 81%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to elasticsearch/src/test/resources/log4j2-test.xml
index 506bef0..62cef26 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/elasticsearch/src/test/resources/log4j2-test.xml
@@ -15,18 +15,18 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <Logger name="org.elasticsearch" level="WARN"/>
   </Loggers>
 </Configuration>
diff --git a/example/csv/build.gradle.kts b/example/csv/build.gradle.kts
index d743d4b..edf2d8e 100644
--- a/example/csv/build.gradle.kts
+++ b/example/csv/build.gradle.kts
@@ -46,6 +46,8 @@ dependencies {
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
+
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 fun JavaCompile.configureAnnotationSet(sourceSet: SourceSet) {
diff --git a/example/function/build.gradle.kts 
b/example/function/build.gradle.kts
index a5bd1c6..b030d0c 100644
--- a/example/function/build.gradle.kts
+++ b/example/function/build.gradle.kts
@@ -20,4 +20,5 @@ dependencies {
     api("org.checkerframework:checker-qual")
 
     testImplementation("sqlline:sqlline")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
diff --git a/file/build.gradle.kts b/file/build.gradle.kts
index 7b84e3d..37373cc 100644
--- a/file/build.gradle.kts
+++ b/file/build.gradle.kts
@@ -40,6 +40,7 @@ dependencies {
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 fun JavaCompile.configureAnnotationSet(sourceSet: SourceSet) {
diff --git a/geode/build.gradle.kts b/geode/build.gradle.kts
index ee4be0d..bf51ecd 100644
--- a/geode/build.gradle.kts
+++ b/geode/build.gradle.kts
@@ -34,7 +34,7 @@ dependencies {
 
     testImplementation(project(":testkit"))
     testImplementation("com.fasterxml.jackson.core:jackson-databind")
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
diff --git a/geode/src/test/resources/log4j.properties 
b/geode/src/test/resources/log4j.properties
deleted file mode 100644
index 215c6ad..0000000
--- a/geode/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,28 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-log4j.logger.org.apache.calcite.adapter.geode=WARN
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/geode/src/test/resources/log4j2-test.xml
similarity index 68%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to geode/src/test/resources/log4j2-test.xml
index 506bef0..faa3711 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/geode/src/test/resources/log4j2-test.xml
@@ -15,18 +15,22 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <!-- Only report errors coming from Geode or its dependencies-->
+    <logger name="org.apache.geode" level="ERROR"/>
+    <logger name="org.eclipse.jetty" level="ERROR"/>
+    <!-- Change level to INFO to see OQL queries -->
+    <logger name="org.apache.calcite.adapter.geode" level="WARN"/>
   </Loggers>
 </Configuration>
diff --git a/gradle.properties b/gradle.properties
index 5d00527..13547ca 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -76,7 +76,7 @@ aggdesigner-algorithm.version=6.0
 apiguardian-api.version=1.1.0
 asm.version=7.2
 bouncycastle.version=1.60
-cassandra-all.version=3.11.2
+cassandra-all.version=3.11.3
 cassandra-driver-core.version=3.6.0
 cassandra-unit.version=3.5.0.1
 chinook-data-hsqldb.version=0.1
diff --git a/innodb/build.gradle.kts b/innodb/build.gradle.kts
index 55effb9..8bc544d 100644
--- a/innodb/build.gradle.kts
+++ b/innodb/build.gradle.kts
@@ -24,7 +24,10 @@ plugins {
 dependencies {
     api(project(":core"))
     api(project(":linq4j"))
-    api("com.alibaba.database:innodb-java-reader")
+    api("com.alibaba.database:innodb-java-reader") {
+        exclude("org.slf4j", "slf4j-log4j12")
+                .because("creates conflict with log4j-slf4j-impl")
+    }
     api("com.google.guava:guava")
 
     implementation("commons-collections:commons-collections")
@@ -33,7 +36,7 @@ dependencies {
     implementation("org.slf4j:slf4j-api")
 
     testImplementation(project(":testkit"))
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
     compileOnly("com.google.code.findbugs:jsr305")
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/innodb/src/test/resources/log4j2-test.xml
similarity index 77%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to innodb/src/test/resources/log4j2-test.xml
index 506bef0..9f62aec 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/innodb/src/test/resources/log4j2-test.xml
@@ -15,18 +15,18 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <logger name="com.alibaba.innodb" level="WARN"/>
   </Loggers>
 </Configuration>
diff --git a/kafka/build.gradle.kts b/kafka/build.gradle.kts
index b721118..16abc9a 100644
--- a/kafka/build.gradle.kts
+++ b/kafka/build.gradle.kts
@@ -23,4 +23,5 @@ dependencies {
     implementation("com.google.guava:guava")
 
     testImplementation(project(":testkit"))
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/kafka/src/test/resources/log4j2-test.xml
similarity index 77%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to kafka/src/test/resources/log4j2-test.xml
index 506bef0..da5ccc3 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/kafka/src/test/resources/log4j2-test.xml
@@ -15,18 +15,18 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <logger name="org.apache.calcite.adapter.kafka" level="WARN"/>
   </Loggers>
 </Configuration>
diff --git a/mongodb/build.gradle.kts b/mongodb/build.gradle.kts
index c36e4fa..bd5a63a 100644
--- a/mongodb/build.gradle.kts
+++ b/mongodb/build.gradle.kts
@@ -27,4 +27,5 @@ dependencies {
     testImplementation("de.bwaldvogel:mongo-java-server-core")
     testImplementation("de.bwaldvogel:mongo-java-server-memory-backend")
     testImplementation("net.hydromatic:foodmart-data-json")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
diff --git a/mongodb/src/test/resources/log4j.properties 
b/mongodb/src/test/resources/log4j.properties
deleted file mode 100644
index c961576..0000000
--- a/mongodb/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/mongodb/src/test/resources/log4j2-test.xml
similarity index 67%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to mongodb/src/test/resources/log4j2-test.xml
index 506bef0..d316d45 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/mongodb/src/test/resources/log4j2-test.xml
@@ -15,18 +15,22 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <!-- Only report errors coming from MongoDB or its dependencies-->
+    <logger name="org.mongodb" level="ERROR"/>
+    <logger name="de.bwaldvogel.mongo" level="ERROR"/>
+    <!-- Hide warnings coming from MongoDB failed rule attempts -->
+    <logger name="org.apache.calcite.plan.RelOptPlanner" level="ERROR"/>
   </Loggers>
 </Configuration>
diff --git a/plus/build.gradle.kts b/plus/build.gradle.kts
index f3ea54f..2aef9d2 100644
--- a/plus/build.gradle.kts
+++ b/plus/build.gradle.kts
@@ -31,4 +31,5 @@ dependencies {
 
     testImplementation(project(":testkit"))
     testImplementation("org.incava:java-diff")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
diff --git a/cassandra/src/test/resources/logback-test.xml 
b/plus/src/test/resources/log4j2-test.xml
similarity index 62%
rename from cassandra/src/test/resources/logback-test.xml
rename to plus/src/test/resources/log4j2-test.xml
index 723eff9..4391020 100644
--- a/cassandra/src/test/resources/logback-test.xml
+++ b/plus/src/test/resources/log4j2-test.xml
@@ -15,21 +15,20 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
+<Configuration>
+  <Appenders>
+    <Console name="A1" target="SYSTEM_OUT">
+      <PatternLayout
+          pattern="%d [%t] %-5p - %m%n"/>
+    </Console>
+  </Appenders>
 
-<!-- Cassandra Unit uses logback API for logging -->
-<configuration>
+  <Loggers>
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
+    </Root>
 
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - 
%msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="error">
-    <appender-ref ref="STDOUT" />
-  </root>
-
-  <!-- Avoid showing connection errors on cassandra shutdown -->
-  <logger name="com.datastax.driver.core.ControlConnection" level="off" 
additivity="false"/>
-
-</configuration>
+    <logger name="org.apache.calcite.avatica" level="WARN"/>
+    <logger name="org.eclipse.jetty" level="WARN"/>
+  </Loggers>
+</Configuration>
diff --git a/redis/build.gradle.kts b/redis/build.gradle.kts
index 0579a5c..80e2475 100644
--- a/redis/build.gradle.kts
+++ b/redis/build.gradle.kts
@@ -30,6 +30,6 @@ dependencies {
     testImplementation(project(":testkit"))
     testImplementation("com.github.kstyrc:embedded-redis")
     testImplementation("org.mockito:mockito-core")
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
     testImplementation("org.testcontainers:testcontainers")
 }
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/redis/src/test/resources/log4j2-test.xml
similarity index 70%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to redis/src/test/resources/log4j2-test.xml
index 506bef0..1afa73e 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/redis/src/test/resources/log4j2-test.xml
@@ -15,18 +15,21 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%logger %d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <!-- Silence messages coming from testcontainers-->
+    <logger name="org.testcontainers" level="WARN"/>
+    <!-- Change level to debug problems in Redis adapter-->
+    <logger name="org.apache.calcite.plan.RelOptPlanner" level="WARN"/>
   </Loggers>
 </Configuration>
diff --git a/server/build.gradle.kts b/server/build.gradle.kts
index ede256e..0e28a5f 100644
--- a/server/build.gradle.kts
+++ b/server/build.gradle.kts
@@ -33,7 +33,7 @@ dependencies {
     testImplementation("net.hydromatic:scott-data-hsqldb")
     testImplementation("org.hsqldb:hsqldb")
     testImplementation("org.incava:java-diff")
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
 
 val fmppMain by 
tasks.registering(org.apache.calcite.buildtools.fmpp.FmppTask::class) {
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/server/src/test/resources/log4j2-test.xml
similarity index 77%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to server/src/test/resources/log4j2-test.xml
index 506bef0..243251d 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/server/src/test/resources/log4j2-test.xml
@@ -15,18 +15,20 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%logger %d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+
+    <logger name="hsqldb.db" level="WARN"/>
+    <logger name="org.apache.calcite.plan.RexImplicationChecker" 
level="ERROR"/>
   </Loggers>
 </Configuration>
diff --git a/spark/build.gradle.kts b/spark/build.gradle.kts
index f2baa7a..95e1010 100644
--- a/spark/build.gradle.kts
+++ b/spark/build.gradle.kts
@@ -17,7 +17,10 @@
 dependencies {
     api(project(":core"))
     api(project(":linq4j"))
-    api("org.apache.spark:spark-core_2.10")
+    api("org.apache.spark:spark-core_2.10") {
+        exclude("org.slf4j", "slf4j-log4j12")
+                .because("conflicts with log4j-slf4j-impl")
+    }
 
     implementation("com.google.guava:guava")
     implementation("org.eclipse.jetty:jetty-server")
@@ -28,4 +31,5 @@ dependencies {
     runtimeOnly("xerces:xercesImpl")
 
     testImplementation(project(":testkit"))
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 }
diff --git a/spark/src/test/resources/log4j.properties 
b/spark/src/test/resources/log4j.properties
deleted file mode 100644
index 551e77c..0000000
--- a/spark/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,29 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# Silence Spark output by default
-log4j.logger.org.apache.spark=WARN
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/spark/src/test/resources/log4j2-test.xml
similarity index 69%
copy from elasticsearch/src/test/resources/log4j2.xml
copy to spark/src/test/resources/log4j2-test.xml
index 506bef0..c537847 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/spark/src/test/resources/log4j2-test.xml
@@ -15,18 +15,22 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+    <!-- Only report errors coming from Spark or its dependencies-->
+    <logger name="org.apache.spark" level="ERROR"/>
+    <logger name="org.spark_project" level="ERROR"/>
+    <logger name="org.apache.hadoop" level="ERROR"/>
+    <logger name="org.eclipse.jetty" level="ERROR"/>
   </Loggers>
 </Configuration>
diff --git a/splunk/build.gradle.kts b/splunk/build.gradle.kts
index 2fde470..e087ef2 100644
--- a/splunk/build.gradle.kts
+++ b/splunk/build.gradle.kts
@@ -31,7 +31,7 @@ dependencies {
     implementation("net.sf.opencsv:opencsv")
 
     testImplementation(project(":testkit"))
-    testRuntimeOnly("org.slf4j:slf4j-log4j12")
+    testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
 
     annotationProcessor("org.immutables:value")
     compileOnly("org.immutables:value-annotations")
diff --git a/splunk/src/test/resources/log4j.properties 
b/splunk/src/test/resources/log4j.properties
deleted file mode 100644
index c961576..0000000
--- a/splunk/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
diff --git a/elasticsearch/src/test/resources/log4j2.xml 
b/splunk/src/test/resources/log4j2-test.xml
similarity index 77%
rename from elasticsearch/src/test/resources/log4j2.xml
rename to splunk/src/test/resources/log4j2-test.xml
index 506bef0..602c148 100644
--- a/elasticsearch/src/test/resources/log4j2.xml
+++ b/splunk/src/test/resources/log4j2-test.xml
@@ -15,18 +15,19 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<Configuration status="WARN">
+<Configuration>
   <Appenders>
-    <Console name="console" target="SYSTEM_OUT">
+    <Console name="A1" target="SYSTEM_OUT">
       <PatternLayout
-          pattern="[%-5level] %d{HH:mm:ss.SSS} %logger{36}.%M() - %msg%n" />
+          pattern="%d [%t] %-5p - %m%n"/>
     </Console>
   </Appenders>
 
   <Loggers>
-    <Logger name="org.elasticsearch" level="WARN"/>
-    <Root level="INFO" additivity="false">
-      <AppenderRef ref="console" />
+    <Root level="INFO">
+      <AppenderRef ref="A1"/>
     </Root>
+
+    <logger name="org.apache.calcite.adapter.splunk" level="WARN"/>
   </Loggers>
 </Configuration>

Reply via email to