Skip to content

Commit cec8b03

Browse files
committed
[KYUUBI #2850][FOLLOWUP] Provide log4j2.xml.template in binary and use log4j2-defaults.xml
### _Why are the changes needed?_ This is a follow up of #2850 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [x] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2971 from turboFei/remove_on_match_from_default. Closes #2850 10e6067 [Fei Wang] refactor 929fde7 [Fei Wang] comments 4ad12f1 [Fei Wang] add log4j1 91168b6 [Fei Wang] fix e5ac285 [Fei Wang] fix efe789e [Fei Wang] [KYUUBI #2850][FOLLOWUP] Use log4j2 xml to take replace of log4j2 properties Authored-by: Fei Wang <fwang12@ebay.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent b7cd6f9 commit cec8b03

File tree

5 files changed

+87
-40
lines changed

5 files changed

+87
-40
lines changed

conf/log4j2.xml.template

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<!-- Provide log4j2.xml.template to fix `ERROR Filters contains invalid attributes "onMatch", "onMismatch"`, see KYUUBI-2247 -->
20+
<!-- Extra logging related to initialization of Log4j.
21+
Set to debug or trace if log4j initialization is failing. -->
22+
<Configuration status="INFO">
23+
<Appenders>
24+
<Console name="stdout" target="SYSTEM_OUT">
25+
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p %c: %m%n"/>
26+
<Filters>
27+
<ThresholdFilter level="FATAL"/>
28+
<RegexFilter regex=".*Thrift error occurred during processing of message.*" onMatch="DENY" onMismatch="NEUTRAL"/>
29+
</Filters>
30+
</Console>
31+
</Appenders>
32+
<Loggers>
33+
<Root level="INFO">
34+
<AppenderRef ref="stdout"/>
35+
</Root>
36+
<Logger name="org.apache.kyuubi.ctl.ServiceControlCli" level="error" additivity="false">
37+
<AppenderRef ref="stdout"/>
38+
</Logger>
39+
<!--
40+
<Logger name="org.apache.kyuubi.server.mysql.codec" level="trace" additivity="false">
41+
<AppenderRef ref="stdout"/>
42+
</Logger>
43+
-->
44+
<Logger name="org.apache.hive.beeline.KyuubiBeeLine" level="error" additivity="false">
45+
<AppenderRef ref="stdout"/>
46+
</Logger>
47+
</Loggers>
48+
</Configuration>

kyuubi-common/src/main/resources/log4j2-defaults.properties

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<!-- Extra logging related to initialization of Log4j.
20+
Set to debug or trace if log4j initialization is failing. -->
21+
<Configuration status="INFO">
22+
<Appenders>
23+
<Console name="stdout" target="SYSTEM_OUT">
24+
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p %c: %m%n"/>
25+
<Filters>
26+
<ThresholdFilter level="FATAL"/>
27+
<RegexFilter regex=".*Thrift error occurred during processing of message.*" onMatch="DENY" onMismatch="NEUTRAL"/>
28+
</Filters>
29+
</Console>
30+
</Appenders>
31+
<Loggers>
32+
<Root level="INFO">
33+
<AppenderRef ref="stdout"/>
34+
</Root>
35+
</Loggers>
36+
</Configuration>

kyuubi-common/src/main/scala/org/apache/kyuubi/Logging.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ trait Logging {
9696
// scalastyle:off println
9797
if (Logging.isLog4j2DefaultConfigured()) {
9898
Logging.useDefault = true
99-
val defaultLogProps = "log4j2-defaults.properties"
99+
val defaultLogProps = "log4j2-defaults.xml"
100100
Option(Thread.currentThread().getContextClassLoader.getResource(defaultLogProps)) match {
101101
case Some(url) =>
102102
val context = LogManager.getContext(false).asInstanceOf[LoggerContext]

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,8 @@
15991599
</environmentVariables>
16001600
<systemProperties>
16011601
<log4j.ignoreTCL>true</log4j.ignoreTCL>
1602-
<log4j2.configurationFile>file:src/test/resources/log4j2-test.xml</log4j2.configurationFile>
1602+
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
1603+
<log4j2.configurationFile>src/test/resources/log4j2-test.xml</log4j2.configurationFile>
16031604
<java.io.tmpdir>${project.build.directory}/tmp</java.io.tmpdir>
16041605
<spark.driver.memory>1g</spark.driver.memory>
16051606
<kyuubi.metrics.json.location>${project.build.directory}/metrics</kyuubi.metrics.json.location>

0 commit comments

Comments
 (0)