Skip to content

Commit

Permalink
HBASE-26854 Shell startup logs a bunch of noise (apache#4469)
Browse files Browse the repository at this point in the history
Upon startup the shell logs a bunch of noise, mainly from zookeeper.
Also hide WARN level logging from the Hadoop libraries

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
(cherry picked from commit 20895c7)
  • Loading branch information
apurtell authored and Villő Szűcs committed Aug 22, 2024
1 parent 3fcce76 commit b056f81
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hbase-shell/src/main/ruby/jar-bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def add_to_configuration(c, arg)
opts.ordering = GetoptLong::REQUIRE_ORDER

script2run = nil
log_level = org.apache.log4j.Level::ERROR
log_level = org.apache.logging.log4j.Level::ERROR
@shell_debug = false
interactive = true
full_backtrace = false
Expand All @@ -118,7 +118,7 @@ def add_to_configuration(c, arg)
when D_ARG
conf_from_cli = add_to_configuration(conf_from_cli, arg)
when '--debug'
log_level = org.apache.log4j.Level::DEBUG
log_level = org.apache.logging.log4j.Level::DEBUG
full_backtrace = true
@shell_debug = true
puts 'Setting DEBUG log level...'
Expand All @@ -138,8 +138,8 @@ def add_to_configuration(c, arg)
ARGV.unshift('-d') if @shell_debug

# Set logging level to avoid verboseness
org.apache.log4j.Logger.getLogger('org.apache.zookeeper').setLevel(log_level)
org.apache.log4j.Logger.getLogger('org.apache.hadoop.hbase').setLevel(log_level)
org.apache.logging.log4j.core.config.Configurator.setAllLevels('org.apache.zookeeper', log_level)
org.apache.logging.log4j.core.config.Configurator.setAllLevels('org.apache.hadoop', log_level)

# Require HBase now after setting log levels
require 'hbase_constants'
Expand All @@ -165,14 +165,14 @@ def debug
if @shell_debug
@shell_debug = false
conf.back_trace_limit = 0
log_level = org.apache.log4j.Level::ERROR
log_level = org.apache.logging.log4j.Level::ERROR
else
@shell_debug = true
conf.back_trace_limit = 100
log_level = org.apache.log4j.Level::DEBUG
log_level = org.apache.logging.log4j.Level::DEBUG
end
org.apache.log4j.Logger.getLogger('org.apache.zookeeper').setLevel(log_level)
org.apache.log4j.Logger.getLogger('org.apache.hadoop.hbase').setLevel(log_level)
org.apache.logging.log4j.core.config.Configurator.setAllLevels('org.apache.zookeeper', log_level)
org.apache.logging.log4j.core.config.Configurator.setAllLevels('org.apache.hadoop', log_level)
debug?
end

Expand Down

0 comments on commit b056f81

Please sign in to comment.