Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions bin/hbase
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
#
# HBASE_CONF_DIR Alternate conf dir. Default is ${HBASE_HOME}/conf.
#
# HBASE_ROOT_LOGGER The root appender. Default is INFO,console
# HBASE_ROOT_LOGGER_LEVEL The root logger level. Default is INFO.
#
# HBASE_ROOT_LOGGER_APPENDER The root logger appemder. Default is console.
#
# JRUBY_HOME JRuby path: $JRUBY_HOME/lib/jruby.jar should exist.
# Defaults to the jar packaged with HBase.
Expand Down Expand Up @@ -294,7 +296,10 @@ fi
for f in "${HBASE_HOME}"/lib/client-facing-thirdparty/*.jar; do
if [[ ! "${f}" =~ ^.*/htrace-core-3.*\.jar$ ]] && \
[ "${f}" != "htrace-core.jar$" ] && \
[[ ! "${f}" =~ ^.*/slf4j-log4j.*$ ]]; then
[[ ! "${f}" =~ ^.*/log4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/slf4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/jcl-over-slf4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/jul-to-slf4j.*$ ]]; then
CLASSPATH="${CLASSPATH}:${f}"
fi
done
Expand Down Expand Up @@ -639,7 +644,10 @@ elif [ "$COMMAND" = "mapredcp" ] ; then
for f in "${HBASE_HOME}"/lib/client-facing-thirdparty/*.jar; do
if [[ ! "${f}" =~ ^.*/htrace-core-3.*\.jar$ ]] && \
[ "${f}" != "htrace-core.jar$" ] && \
[[ ! "${f}" =~ ^.*/slf4j-log4j.*$ ]]; then
[[ ! "${f}" =~ ^.*/log4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/slf4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/jcl-over-slf4j.*$ ]] && \
[[ ! "${f}" =~ ^.*/jul-to-slf4j.*$ ]]; then
echo -n ":${f}"
fi
done
Expand Down Expand Up @@ -756,22 +764,43 @@ HBASE_OPTS="$HBASE_OPTS -Dhbase.log.dir=$HBASE_LOG_DIR"
HBASE_OPTS="$HBASE_OPTS -Dhbase.log.file=$HBASE_LOGFILE"
HBASE_OPTS="$HBASE_OPTS -Dhbase.home.dir=$HBASE_HOME"
HBASE_OPTS="$HBASE_OPTS -Dhbase.id.str=$HBASE_IDENT_STRING"
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger=${HBASE_ROOT_LOGGER:-INFO,console}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger.level=${HBASE_ROOT_LOGGER_LEVEL:-INFO}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger.appender=${HBASE_ROOT_LOGGER_APPENDER:-console}"
if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
HBASE_OPTS="$HBASE_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$JAVA_LIBRARY_PATH"
fi

# Enable security logging on the master and regionserver only
if [ "$COMMAND" = "master" ] || [ "$COMMAND" = "regionserver" ]; then
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger=${HBASE_SECURITY_LOGGER:-INFO,RFAS}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger.level=${HBASE_SECURITY_LOGGER_LEVEL:-INFO}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger.appender=${HBASE_SECURITY_LOGGER_APPENDER:-RFAS}"
else
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger=${HBASE_SECURITY_LOGGER:-INFO,NullAppender}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger.level=${HBASE_SECURITY_LOGGER_LEVEL:-INFO,NullAppender}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger.appender=${HBASE_SECURITY_LOGGER_APPENDER:-NullAppender}"
fi

HEAP_SETTINGS="$JAVA_HEAP_MAX $JAVA_OFFHEAP_MAX"
# by now if we're running a command it means we need logging
for f in ${HBASE_HOME}/lib/client-facing-thirdparty/slf4j-log4j*.jar; do
for f in ${HBASE_HOME}/lib/client-facing-thirdparty/log4j*.jar; do
if [ -f "${f}" ]; then
CLASSPATH="${CLASSPATH}:${f}"
break
fi
done
for f in ${HBASE_HOME}/lib/client-facing-thirdparty/slf4j*.jar; do
if [ -f "${f}" ]; then
CLASSPATH="${CLASSPATH}:${f}"
break
fi
done
for f in ${HBASE_HOME}/lib/client-facing-thirdparty/jcl-over-slf4j*.jar; do
if [ -f "${f}" ]; then
CLASSPATH="${CLASSPATH}:${f}"
break
fi
done
for f in ${HBASE_HOME}/lib/client-facing-thirdparty/jul-to-slf4j*.jar; do
if [ -f "${f}" ]; then
CLASSPATH="${CLASSPATH}:${f}"
break
Expand Down
16 changes: 12 additions & 4 deletions bin/hbase-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,20 @@ JAVA=$JAVA_HOME/bin/java
export HBASE_LOG_PREFIX=hbase-$HBASE_IDENT_STRING-$command-$HOSTNAME
export HBASE_LOGFILE=$HBASE_LOG_PREFIX.log

if [ -z "${HBASE_ROOT_LOGGER}" ]; then
export HBASE_ROOT_LOGGER=${HBASE_ROOT_LOGGER:-"INFO,RFA"}
if [ -z "${HBASE_ROOT_LOGGER_LEVEL}" ]; then
export HBASE_ROOT_LOGGER_LEVEL=${HBASE_ROOT_LOGGER_LEVEL:-"INFO"}
fi

if [ -z "${HBASE_SECURITY_LOGGER}" ]; then
export HBASE_SECURITY_LOGGER=${HBASE_SECURITY_LOGGER:-"INFO,RFAS"}
if [ -z "${HBASE_ROOT_LOGGER_APPENDER}" ]; then
export HBASE_ROOT_LOGGER_APPENDER=${HBASE_ROOT_LOGGER_APPENDER:-"RFA"}
fi

if [ -z "${HBASE_SECURITY_LOGGER_LEVEL}" ]; then
export HBASE_SECURITY_LOGGER_LEVEL=${HBASE_SECURITY_LOGGER_LEVEL:-"INFO"}
fi

if [ -z "${HBASE_SECURITY_LOGGER_APPENDER}" ]; then
export HBASE_SECURITY_LOGGER_APPENDER=${HBASE_SECURITY_LOGGER_APPENDER:-"RFAS"}
fi

HBASE_LOGOUT=${HBASE_LOGOUT:-"$HBASE_LOG_DIR/$HBASE_LOG_PREFIX.out"}
Expand Down
46 changes: 34 additions & 12 deletions bin/hbase.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
@rem
@rem HBASE_CONF_DIR Alternate conf dir. Default is ${HBASE_HOME}/conf.
@rem
@rem HBASE_ROOT_LOGGER The root appender. Default is INFO,console
@rem HBASE_ROOT_LOGGER_LEVEL The root logger level. Default is INFO.
@rem
@rem HBASE_ROOT_LOGGER_APPENDER The root logger appender. Default is console.
@rem
@rem JRUBY_HOME JRuby path: $JRUBY_HOME\lib\jruby.jar should exist.
@rem Defaults to the jar packaged with HBase.
Expand Down Expand Up @@ -250,10 +252,14 @@ if "%servercommand%" == "true" (
if defined service_entry (
set HBASE_LOG_PREFIX=hbase-%hbase-command%-%COMPUTERNAME%
set HBASE_LOGFILE=!HBASE_LOG_PREFIX!.log
if not defined HBASE_ROOT_LOGGER (
set HBASE_ROOT_LOGGER=INFO,DRFA
if not defined HBASE_ROOT_LOGGER_LEVEL (
set HBASE_ROOT_LOGGER_LEVEL=INFO
)
if not defined HBASE_ROOT_LOGGER_APPENDER (
set HBASE_ROOT_LOGGER_APPENDER=DRFA
)
set HBASE_SECURITY_LOGGER=INFO,DRFAS
set HBASE_SECURITY_LOGGER_LEVEL=INFO
set HBASE_SECURITY_LOGGER_APPENDER=DRFAS
set loggc=!HBASE_LOG_DIR!\!HBASE_LOG_PREFIX!.gc
set loglog=!HBASE_LOG_DIR!\!HBASE_LOGFILE!

Expand Down Expand Up @@ -317,26 +323,42 @@ set HBASE_OPTS=%HBASE_OPTS% -Dhbase.home.dir="%HBASE_HOME%"
set HBASE_OPTS=%HBASE_OPTS% -Dhbase.id.str="%HBASE_IDENT_STRING%"
set HBASE_OPTS=%HBASE_OPTS% -XX:OnOutOfMemoryError="taskkill /F /PID %p"

if not defined HBASE_ROOT_LOGGER (
set HBASE_ROOT_LOGGER=INFO,console
if not defined HBASE_ROOT_LOGGER_LEVEL (
set HBASE_ROOT_LOGGER_LEVEL=INFO
)

if not defined HBASE_ROOT_LOGGER_APPENDER (
set HBASE_ROOT_LOGGER_LEVEL=console
)
set HBASE_OPTS=%HBASE_OPTS% -Dhbase.root.logger="%HBASE_ROOT_LOGGER%"

set HBASE_OPTS=%HBASE_OPTS% -Dhbase.root.logger.level="%HBASE_ROOT_LOGGER_LEVEL% -Dhbase.root.logger.appender="%HBASE_ROOT_LOGGER_APPENDER% "

if defined JAVA_LIBRARY_PATH (
set HBASE_OPTS=%HBASE_OPTS% -Djava.library.path="%JAVA_LIBRARY_PATH%"
)

rem Enable security logging on the master and regionserver only
if not defined HBASE_SECURITY_LOGGER (
set HBASE_SECURITY_LOGGER=INFO,NullAppender
if not defined HBASE_SECURITY_LOGGER_LEVEL (
set HBASE_SECURITY_LOGGER_LEVEL=INFO
if "%hbase-command%"=="master" (
set HBASE_SECURITY_LOGGER_LEVEL=INFO
)
if "%hbase-command%"=="regionserver" (
set HBASE_SECURITY_LOGGER_LEVEL=INFO
)
)

if not defined HBASE_SECURITY_LOGGER_APPENDER (
set HBASE_SECURITY_LOGGER_APPENDER=NullAppender
if "%hbase-command%"=="master" (
set HBASE_SECURITY_LOGGER=INFO,DRFAS
set HBASE_SECURITY_LOGGER_APPENDER=DRFAS
)
if "%hbase-command%"=="regionserver" (
set HBASE_SECURITY_LOGGER=INFO,DRFAS
set HBASE_SECURITY_LOGGER_APPENDER=DRFAS
)
)
set HBASE_OPTS=%HBASE_OPTS% -Dhbase.security.logger="%HBASE_SECURITY_LOGGER%"

set HBASE_OPTS=%HBASE_OPTS% -Dhbase.security.logger.level="%HBASE_SECURITY_LOGGER_LEVEL% -Dhbase.security.logger.appender="%HBASE_SECURITY_LOGGER_APPENDER%"

set HEAP_SETTINGS=%JAVA_HEAP_MAX% %JAVA_OFFHEAP_MAX%
set java_arguments=%HEAP_SETTINGS% %HBASE_OPTS% -classpath "%CLASSPATH%" %CLASS% %hbase-command-arguments%
Expand Down
27 changes: 0 additions & 27 deletions conf/log4j-hbtop.properties

This file was deleted.

128 changes: 0 additions & 128 deletions conf/log4j.properties

This file was deleted.

35 changes: 35 additions & 0 deletions conf/log4j2-hbtop.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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.
*/
-->
<Configuration>
<Appenders>
<!-- Console appender -->
<Console name="console" target="SYSTEM_ERR">
<PatternLayout pattern="%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="console" />
</Root>
<!-- ZooKeeper will still put stuff at WARN -->
<Logger name="org.apache.zookeeper" level="error" />
</Loggers>
</Configuration>
Loading