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

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


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 9e9ee19d3 [KYUUBI #6196] Add log4j2 template for kyuubi repl commands
9e9ee19d3 is described below

commit 9e9ee19d3001c0282f73f3d307e1914e1a8d35f5
Author: wforget <[email protected]>
AuthorDate: Tue Mar 19 14:35:53 2024 +0800

    [KYUUBI #6196] Add log4j2 template for kyuubi repl commands
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Add log4j2 template for kyuubi repl command.
    
    Since I want to add rolling logs for kyuubi server, we need to add 
independent log4j properties for kyuubi repl command.
    
    ## Types of changes :bookmark:
    
    - [ ] Bugfix (non-breaking change which fixes an issue)
    - [X] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior Without This Pull Request :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### Related Unit Tests
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [X] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6196 from wForget/log4j_repl.
    
    Closes #6196
    
    d8d64644d [wforget] newline
    10a5b9fff [wforget] remove filter
    a775ee2d5 [wforget] Add log4j2 template for kyuubi repl command
    
    Authored-by: wforget <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 31469fa7a63861edc5adaecb917eb409b1eb31ed)
    Signed-off-by: Cheng Pan <[email protected]>
---
 bin/beeline                   |  4 ++++
 bin/kyuubi-admin              |  4 ++++
 bin/kyuubi-ctl                |  4 ++++
 bin/kyuubi-zk-cli             |  6 +++++-
 conf/log4j2-repl.xml.template | 33 +++++++++++++++++++++++++++++++++
 conf/log4j2.xml.template      |  5 +----
 6 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/bin/beeline b/bin/beeline
index f277efa44..ada7fecfa 100755
--- a/bin/beeline
+++ b/bin/beeline
@@ -52,4 +52,8 @@ else
   
KYUUBI_BEELINE_CLASSPATH="${KYUUBI_BEELINE_JARS}/*:${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
 fi
 
+if [[ -f ${KYUUBI_CONF_DIR}/log4j2-repl.xml ]]; then
+  KYUUBI_CTL_JAVA_OPTS="${KYUUBI_CTL_JAVA_OPTS} 
-Dlog4j2.configurationFile=log4j2-repl.xml"
+fi
+
 exec ${RUNNER} ${KYUUBI_BEELINE_OPTS} -cp ${KYUUBI_BEELINE_CLASSPATH} $CLASS 
"$@"
diff --git a/bin/kyuubi-admin b/bin/kyuubi-admin
index 8a148d159..3a6be7672 100755
--- a/bin/kyuubi-admin
+++ b/bin/kyuubi-admin
@@ -47,4 +47,8 @@ else
   
KYUUBI_CLASSPATH="${KYUUBI_JAR_DIR}/*:${KYUUBI_CONF_DIR}:${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
 fi
 
+if [[ -f ${KYUUBI_CONF_DIR}/log4j2-repl.xml ]]; then
+  KYUUBI_CTL_JAVA_OPTS="${KYUUBI_CTL_JAVA_OPTS} 
-Dlog4j2.configurationFile=log4j2-repl.xml"
+fi
+
 exec ${RUNNER} ${KYUUBI_CTL_JAVA_OPTS} -cp ${KYUUBI_CLASSPATH} $CLASS "$@"
diff --git a/bin/kyuubi-ctl b/bin/kyuubi-ctl
index 0214737d4..96bcd8b81 100755
--- a/bin/kyuubi-ctl
+++ b/bin/kyuubi-ctl
@@ -47,4 +47,8 @@ else
   
KYUUBI_CLASSPATH="${KYUUBI_JAR_DIR}/*:${KYUUBI_CONF_DIR}:${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
 fi
 
+if [[ -f ${KYUUBI_CONF_DIR}/log4j2-repl.xml ]]; then
+  KYUUBI_CTL_JAVA_OPTS="${KYUUBI_CTL_JAVA_OPTS} 
-Dlog4j2.configurationFile=log4j2-repl.xml"
+fi
+
 exec ${RUNNER} ${KYUUBI_CTL_JAVA_OPTS} -cp ${KYUUBI_CLASSPATH} $CLASS "$@"
diff --git a/bin/kyuubi-zk-cli b/bin/kyuubi-zk-cli
index c85f47c4c..703105d96 100755
--- a/bin/kyuubi-zk-cli
+++ b/bin/kyuubi-zk-cli
@@ -46,4 +46,8 @@ else
   
KYUUBI_CLASSPATH="${KYUUBI_JAR_DIR}/*:${KYUUBI_CONF_DIR}:${HADOOP_CONF_DIR}:${YARN_CONF_DIR}"
 fi
 
-exec ${RUNNER} ${KYUUBI_JAVA_OPTS} -cp ${KYUUBI_CLASSPATH} $CLASS "$@"
\ No newline at end of file
+if [[ -f ${KYUUBI_CONF_DIR}/log4j2-repl.xml ]]; then
+  KYUUBI_CTL_JAVA_OPTS="${KYUUBI_CTL_JAVA_OPTS} 
-Dlog4j2.configurationFile=log4j2-repl.xml"
+fi
+
+exec ${RUNNER} ${KYUUBI_JAVA_OPTS} -cp ${KYUUBI_CLASSPATH} $CLASS "$@"
diff --git a/conf/log4j2-repl.xml.template b/conf/log4j2-repl.xml.template
new file mode 100644
index 000000000..0c5fc78b2
--- /dev/null
+++ b/conf/log4j2-repl.xml.template
@@ -0,0 +1,33 @@
+<?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 %tn %c: 
%m%n%ex"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="INFO">
+            <AppenderRef ref="stdout"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/conf/log4j2.xml.template b/conf/log4j2.xml.template
index 215fddf47..c2db4c475 100644
--- a/conf/log4j2.xml.template
+++ b/conf/log4j2.xml.template
@@ -30,9 +30,6 @@
     <Appenders>
         <Console name="stdout" target="SYSTEM_OUT">
             <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %p %tn %c: 
%m%n%ex"/>
-            <Filters>
-                <RegexFilter regex=".*Thrift error occurred during processing 
of message.*" onMatch="DENY" onMismatch="NEUTRAL"/>
-            </Filters>
         </Console>
         <RollingFile name="restAudit" 
fileName="${sys:logDir}/${sys:restAuditLogPath}"
                      filePattern="${sys:restAuditLogFilePattern}">
@@ -55,7 +52,7 @@
         <Root level="INFO">
             <AppenderRef ref="stdout"/>
         </Root>
-        <Logger name="org.apache.kyuubi.ctl.ServiceControlCli" level="error" 
additivity="false">
+        <Logger name="org.apache.kyuubi.ctl" level="error" additivity="false">
             <AppenderRef ref="stdout"/>
         </Logger>
         <!--

Reply via email to