You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/07/04 08:48:10 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2850][FOLLOWUP] Replace log4j2.properties by log4j2.xml

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

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new c7e2b3229 [KYUUBI #2850][FOLLOWUP] Replace log4j2.properties by log4j2.xml
c7e2b3229 is described below

commit c7e2b3229b80cf6ff449c4cfa142c4054b0b4ff2
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Mon Jul 4 16:48:02 2022 +0800

    [KYUUBI #2850][FOLLOWUP] Replace log4j2.properties by log4j2.xml
    
    ### _Why are the changes needed?_
    
    Replace log4j2.properties by log4j2.xml
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3001 from pan3793/log4j.
    
    Closes #2850
    
    e9396017 [Cheng Pan] fix
    4e06c89c [Cheng Pan] [KYUUBI #2850][FOLLOWUP] Replace log4j2.properties by log4j2.xml
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .gitignore                                         |   2 +-
 docs/deployment/settings.md                        | 100 ++++++++++-----------
 .../kyuubi/config/AllKyuubiConfiguration.scala     |   4 +-
 3 files changed, 51 insertions(+), 55 deletions(-)

diff --git a/.gitignore b/.gitignore
index d5b95c21e..7ad3bc1a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,6 @@ embedded_zookeeper/
 **/operation_logs/
 **/server_operation_logs/
 **/engine_operation_logs/
-conf/log4j2.properties
+conf/log4j2.xml
 conf/kyuubi-defaults.conf
 conf/kyuubi-env.sh
diff --git a/docs/deployment/settings.md b/docs/deployment/settings.md
index 563d500c6..0bc775d97 100644
--- a/docs/deployment/settings.md
+++ b/docs/deployment/settings.md
@@ -526,59 +526,55 @@ Please refer to the Flink official online documentation for [SET Statements](htt
 
 ## Logging
 
-Kyuubi uses [log4j](https://logging.apache.org/log4j/2.x/) for logging. You can configure it using `$KYUUBI_HOME/conf/log4j2.properties`.
+Kyuubi uses [log4j](https://logging.apache.org/log4j/2.x/) for logging. You can configure it using `$KYUUBI_HOME/conf/log4j2.xml`.
 ```bash
-#
-# 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.
-#
-
-# Set everything to be logged to the file
-rootLogger.level = info
-rootLogger.appenderRef.stdout.ref = STDOUT
-
-# Console Appender
-appender.console.type = Console
-appender.console.name = STDOUT
-appender.console.target = SYSTEM_OUT
-appender.console.layout.type = PatternLayout
-appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} %p %c: %m%n
-
-appender.console.filter.1.type = Filters
-
-appender.console.filter.1.a.type = ThresholdFilter
-appender.console.filter.1.a.level = info
-
-# SPARK-34128: Suppress undesirable TTransportException warnings, due to THRIFT-4805
-appender.console.filter.1.b.type = RegexFilter
-appender.console.filter.1.b.regex = .*Thrift error occurred during processing of message.*
-appender.console.filter.1.b.onMatch = deny
-appender.console.filter.1.b.onMismatch = neutral
-
-# Set the default kyuubi-ctl log level to WARN. When running the kyuubi-ctl, the
-# log level for this class is used to overwrite the root logger's log level.
-logger.ctl.name = org.apache.kyuubi.ctl.ServiceControlCli
-logger.ctl.level = error
-
-# Analysis MySQLFrontend protocol traffic
-# logger.mysql.name = org.apache.kyuubi.server.mysql.codec
-# logger.mysql.level = trace
-
-# Kyuubi BeeLine
-logger.beeline.name = org.apache.hive.beeline.KyuubiBeeLine
-logger.beeline.level = error
+<?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.
+  -->
+
+<!-- Provide log4j2.xml.template to fix `ERROR Filters contains invalid attributes "onMatch", "onMismatch"`, see KYUUBI-2247 -->
+<!-- Extra logging related to initialization of Log4j.
+ Set to debug or trace if log4j initialization is failing. -->
+<Configuration status="INFO">
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p %c: %m%n"/>
+            <Filters>
+                <RegexFilter regex=".*Thrift error occurred during processing of message.*" onMatch="DENY" onMismatch="NEUTRAL"/>
+            </Filters>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="INFO">
+            <AppenderRef ref="stdout"/>
+        </Root>
+        <Logger name="org.apache.kyuubi.ctl.ServiceControlCli" level="error" additivity="false">
+            <AppenderRef ref="stdout"/>
+        </Logger>
+        <!--
+        <Logger name="org.apache.kyuubi.server.mysql.codec" level="trace" additivity="false">
+            <AppenderRef ref="stdout"/>
+        </Logger>
+        -->
+        <Logger name="org.apache.hive.beeline.KyuubiBeeLine" level="error" additivity="false">
+            <AppenderRef ref="stdout"/>
+        </Logger>
+    </Loggers>
+</Configuration>
 ```
 
 ## Other Configurations
diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/config/AllKyuubiConfiguration.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/config/AllKyuubiConfiguration.scala
index d33df3a81..57664601f 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/config/AllKyuubiConfiguration.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/config/AllKyuubiConfiguration.scala
@@ -248,9 +248,9 @@ class AllKyuubiConfiguration extends KyuubiFunSuite {
     newOutput += ("## Logging")
     newOutput += ""
     newOutput += ("Kyuubi uses [log4j](https://logging.apache.org/log4j/2.x/) for logging." +
-      " You can configure it using `$KYUUBI_HOME/conf/log4j2.properties`.")
+      " You can configure it using `$KYUUBI_HOME/conf/log4j2.xml`.")
 
-    rewriteToConf(Paths.get(kyuubiHome, "conf", "log4j2.properties.template"), newOutput)
+    rewriteToConf(Paths.get(kyuubiHome, "conf", "log4j2.xml.template"), newOutput)
 
     newOutput += ""
     newOutput += ("## Other Configurations")