Skip to content

Commit

Permalink
[KYUUBI apache#6196] Add log4j2 template for kyuubi repl commands
Browse files Browse the repository at this point in the history
# 🔍 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 🔖

- [ ] 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 ⚰️

#### Behavior With This Pull Request 🎉

#### 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 apache#6196 from wForget/log4j_repl.

Closes apache#6196

d8d6464 [wforget] newline
10a5b9f [wforget] remove filter
a775ee2 [wforget] Add log4j2 template for kyuubi repl command

Authored-by: wforget <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 31469fa)
  • Loading branch information
wForget committed Mar 21, 2024
1 parent 9ade789 commit 3ade078
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 5 deletions.
4 changes: 4 additions & 0 deletions bin/beeline
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,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 "$@"
4 changes: 4 additions & 0 deletions bin/kyuubi-admin
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,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 "$@"
4 changes: 4 additions & 0 deletions bin/kyuubi-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,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 "$@"
6 changes: 5 additions & 1 deletion bin/kyuubi-zk-cli
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,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 "$@"
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 "$@"
33 changes: 33 additions & 0 deletions conf/log4j2-repl.xml.template
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 1 addition & 4 deletions conf/log4j2.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -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}">
Expand All @@ -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>
<!--
Expand Down

0 comments on commit 3ade078

Please sign in to comment.