Skip to content

Commit 8c849f1

Browse files
committed
[Kernel] Set default log level in tests to WARN to reduce verbosity; upgrade tests to log4j 2.x (delta-io#5573)
## 🥞 Stacked PR Use this [link](https://github.com/delta-io/delta/pull/5573/files) to review incremental changes. - [**stack/kernel_upgrade_log4j**](delta-io#5573) [[Files changed](https://github.com/delta-io/delta/pull/5573/files)] --------- #### Which Delta project/connector is this regarding? - [ ] Spark - [ ] Standalone - [ ] Flink - [X] Kernel - [ ] Other (fill in here) ## Description Set default log level in tests to WARN to reduce verbosity; upgrade tests to log4j 2.x ## How was this patch tested? dependency and test logging change only; existing CI ## Does this PR introduce _any_ user-facing changes? No
1 parent e893c62 commit 8c849f1

File tree

6 files changed

+102
-90
lines changed

6 files changed

+102
-90
lines changed

build.sbt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,8 @@ lazy val kernelApi = (project in file("kernel/kernel-api"))
835835
"org.scalatest" %% "scalatest" % scalaTestVersion % "test",
836836
"junit" % "junit" % "4.13.2" % "test",
837837
"com.novocode" % "junit-interface" % "0.11" % "test",
838-
"org.slf4j" % "slf4j-log4j12" % "1.7.36" % "test",
838+
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.20.0" % "test",
839+
"org.apache.logging.log4j" % "log4j-core" % "2.20.0" % "test",
839840
"org.assertj" % "assertj-core" % "3.26.3" % "test",
840841
// JMH dependencies allow writing micro-benchmarks for testing performance of components.
841842
// JMH has framework to define benchmarks and takes care of many common functionalities
@@ -942,7 +943,8 @@ lazy val kernelDefaults = (project in file("kernel/kernel-defaults"))
942943
"junit" % "junit" % "4.13.2" % "test",
943944
"commons-io" % "commons-io" % "2.8.0" % "test",
944945
"com.novocode" % "junit-interface" % "0.11" % "test",
945-
"org.slf4j" % "slf4j-log4j12" % "1.7.36" % "test",
946+
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.20.0" % "test",
947+
"org.apache.logging.log4j" % "log4j-core" % "2.20.0" % "test",
946948
// JMH dependencies allow writing micro-benchmarks for testing performance of components.
947949
// JMH has framework to define benchmarks and takes care of many common functionalities
948950
// such as warm runs, cold runs, defining benchmark parameter variables etc.
@@ -1005,6 +1007,8 @@ lazy val kernelUnityCatalog = (project in file("kernel/unitycatalog"))
10051007
libraryDependencies ++= Seq(
10061008
"org.apache.hadoop" % "hadoop-common" % hadoopVersion % "provided",
10071009
"org.scalatest" %% "scalatest" % scalaTestVersion % "test",
1010+
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.20.0" % "test",
1011+
"org.apache.logging.log4j" % "log4j-core" % "2.20.0" % "test",
10081012
),
10091013
unidocSourceFilePatterns += SourceFilePattern("src/main/java/io/delta/unity/"),
10101014
).configureUnidoc()

kernel/kernel-api/src/test/resources/log4j.properties

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (2025) The Delta Lake Project Authors.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
#
13+
14+
# Set everything to be logged to the file target/unit-tests.log
15+
rootLogger.level = warn
16+
rootLogger.appenderRef.file.ref = ${sys:test.appender:-File}
17+
18+
appender.file.type = File
19+
appender.file.name = File
20+
appender.file.fileName = target/unit-tests.log
21+
appender.file.append = true
22+
appender.file.layout.type = PatternLayout
23+
appender.file.layout.pattern = %d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n
24+
25+
# Tests that launch java subprocesses can set the "test.appender" system property to
26+
# "console" to avoid having the child process's logs overwrite the unit test's
27+
# log file.
28+
appender.console.type = Console
29+
appender.console.name = console
30+
appender.console.target = SYSTEM_ERR
31+
appender.console.layout.type = PatternLayout
32+
appender.console.layout.pattern = %t: %m%n

kernel/kernel-defaults/src/test/resources/log4j.properties

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (2025) The Delta Lake Project Authors.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
#
13+
14+
# Set everything to be logged to the file target/unit-tests.log
15+
rootLogger.level = warn
16+
rootLogger.appenderRef.file.ref = ${sys:test.appender:-File}
17+
18+
appender.file.type = File
19+
appender.file.name = File
20+
appender.file.fileName = target/unit-tests.log
21+
appender.file.append = true
22+
appender.file.layout.type = PatternLayout
23+
appender.file.layout.pattern = %d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n
24+
25+
# Tests that launch java subprocesses can set the "test.appender" system property to
26+
# "console" to avoid having the child process's logs overwrite the unit test's
27+
# log file.
28+
appender.console.type = Console
29+
appender.console.name = console
30+
appender.console.target = SYSTEM_ERR
31+
appender.console.layout.type = PatternLayout
32+
appender.console.layout.pattern = %t: %m%n
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (2025) The Delta Lake Project Authors.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
#
13+
14+
# Set everything to be logged to the file target/unit-tests.log
15+
rootLogger.level = warn
16+
rootLogger.appenderRef.file.ref = ${sys:test.appender:-File}
17+
18+
appender.file.type = File
19+
appender.file.name = File
20+
appender.file.fileName = target/unit-tests.log
21+
appender.file.append = true
22+
appender.file.layout.type = PatternLayout
23+
appender.file.layout.pattern = %d{yy/MM/dd HH:mm:ss.SSS} %t %p %c{1}: %m%n
24+
25+
# Tests that launch java subprocesses can set the "test.appender" system property to
26+
# "console" to avoid having the child process's logs overwrite the unit test's
27+
# log file.
28+
appender.console.type = Console
29+
appender.console.name = console
30+
appender.console.target = SYSTEM_ERR
31+
appender.console.layout.type = PatternLayout
32+
appender.console.layout.pattern = %t: %m%n

0 commit comments

Comments
 (0)