mirror of https://github.com/apache/kafka.git
KAFKA-18347 Add tools-log4j2.yaml to config and remove unsed tools-log4j.properties from config (#18351)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
0e2b562427
commit
15f6c9b089
|
@ -23,7 +23,7 @@ fi
|
||||||
# WINDOWS_OS_FORMAT == 1 if Cygwin or MinGW is detected, else 0.
|
# WINDOWS_OS_FORMAT == 1 if Cygwin or MinGW is detected, else 0.
|
||||||
if [[ $(uname -a) =~ "CYGWIN" || $(uname -a) =~ "MINGW" || $(uname -a) =~ "MSYS" ]]; then
|
if [[ $(uname -a) =~ "CYGWIN" || $(uname -a) =~ "MINGW" || $(uname -a) =~ "MSYS" ]]; then
|
||||||
WINDOWS_OS_FORMAT=1
|
WINDOWS_OS_FORMAT=1
|
||||||
export MSYS2_ARG_CONV_EXCL="-Xlog:gc*:file=;-Dlog4j.configuration=;$MSYS2_ARG_CONV_EXCL"
|
export MSYS2_ARG_CONV_EXCL="-Xlog:gc*:file=;-Dlog4j2.configurationFile=;$MSYS2_ARG_CONV_EXCL"
|
||||||
else
|
else
|
||||||
WINDOWS_OS_FORMAT=0
|
WINDOWS_OS_FORMAT=0
|
||||||
fi
|
fi
|
||||||
|
@ -220,10 +220,10 @@ fi
|
||||||
# Log4j settings
|
# Log4j settings
|
||||||
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
|
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
|
||||||
# Log to console. This is a tool.
|
# Log to console. This is a tool.
|
||||||
LOG4J_DIR="$base_dir/config/tools-log4j.properties"
|
LOG4J_DIR="$base_dir/config/tools-log4j2.yaml"
|
||||||
# If Cygwin is detected, LOG4J_DIR is converted to Windows format.
|
# If Cygwin is detected, LOG4J_DIR is converted to Windows format.
|
||||||
(( WINDOWS_OS_FORMAT )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}")
|
(( WINDOWS_OS_FORMAT )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}")
|
||||||
KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}"
|
KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=${LOG4J_DIR}"
|
||||||
else
|
else
|
||||||
if echo "$KAFKA_LOG4J_OPTS" | grep -E "log4j\.[^[:space:]]+(\.properties|\.xml)$"; then
|
if echo "$KAFKA_LOG4J_OPTS" | grep -E "log4j\.[^[:space:]]+(\.properties|\.xml)$"; then
|
||||||
# Enable Log4j 1.x configuration compatibility mode for Log4j 2
|
# Enable Log4j 1.x configuration compatibility mode for Log4j 2
|
||||||
|
|
|
@ -116,7 +116,7 @@ IF ["%LOG_DIR%"] EQU [""] (
|
||||||
|
|
||||||
rem Log4j settings
|
rem Log4j settings
|
||||||
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
|
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
|
||||||
set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%BASE_DIR%/config/tools-log4j.properties
|
set KAFKA_LOG4J_OPTS=-Dlog4j2.configurationFile=file:%BASE_DIR%/config/tools-log4j2.yaml
|
||||||
) ELSE (
|
) ELSE (
|
||||||
rem Check if Log4j 1.x configuration options are present in KAFKA_LOG4J_OPTS
|
rem Check if Log4j 1.x configuration options are present in KAFKA_LOG4J_OPTS
|
||||||
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*(\.properties|\.xml)$" >nul
|
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*(\.properties|\.xml)$" >nul
|
||||||
|
|
|
@ -12,10 +12,21 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
Configuration:
|
||||||
|
Properties:
|
||||||
|
Property:
|
||||||
|
- name: "logPattern"
|
||||||
|
value: "[%d] %p %m (%c)%n"
|
||||||
|
|
||||||
log4j.rootLogger=WARN, stderr
|
Appenders:
|
||||||
|
Console:
|
||||||
|
name: STDERR
|
||||||
|
target: SYSTEM_ERR
|
||||||
|
PatternLayout:
|
||||||
|
pattern: "${logPattern}"
|
||||||
|
Loggers:
|
||||||
|
Root:
|
||||||
|
level: WARN
|
||||||
|
AppenderRef:
|
||||||
|
- ref: STDERR
|
||||||
|
|
||||||
log4j.appender.stderr=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.stderr.layout.ConversionPattern=[%d] %p %m (%c)%n
|
|
||||||
log4j.appender.stderr.Target=System.err
|
|
Loading…
Reference in New Issue