HBASE-10092 Addendum. Move to slf4j. Few changes in bin/ scripts.

This commit is contained in:
Apekshit Sharma 2017-12-21 19:20:29 -08:00
parent a4272a9f08
commit 5f02bf5b7b
2 changed files with 4 additions and 22 deletions

View File

@ -27,8 +27,7 @@ java_import org.apache.hadoop.hbase.HBaseConfiguration
java_import org.apache.hadoop.hbase.client.ConnectionFactory
java_import org.apache.hadoop.hbase.client.HBaseAdmin
java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
java_import org.apache.commons.logging.Log
java_import org.apache.commons.logging.LogFactory
java_import org.slf4j.LoggerFactory
# Name of this script
NAME = 'draining_servers'.freeze
@ -43,10 +42,6 @@ optparse = OptionParser.new do |opts|
puts opts
exit
end
options[:debug] = false
opts.on('-d', '--debug', 'Display extra debug logging') do
options[:debug] = true
end
end
optparse.parse!
@ -133,21 +128,8 @@ end
hostOrServers = ARGV[1..ARGV.size]
# Create a logger and disable the DEBUG-level annoying client logging
def configureLogging(options)
apacheLogger = LogFactory.getLog(NAME)
# Configure log4j to not spew so much
unless options[:debug]
logger = org.apache.log4j.Logger.getLogger('org.apache.hadoop.hbase')
logger.setLevel(org.apache.log4j.Level::WARN)
logger = org.apache.log4j.Logger.getLogger('org.apache.zookeeper')
logger.setLevel(org.apache.log4j.Level::WARN)
end
apacheLogger
end
# Create a logger and save it to ruby global
$LOG = configureLogging(options)
$LOG = LoggerFactory.getLogger(NAME)
case ARGV[0]
when 'add'
if ARGV.length < 2

View File

@ -24,7 +24,6 @@
#
include Java
java_import org.apache.commons.logging.LogFactory
java_import org.apache.hadoop.conf.Configuration
java_import org.apache.hadoop.hbase.HBaseConfiguration
java_import org.apache.hadoop.hbase.HConstants
@ -32,6 +31,7 @@ java_import org.apache.hadoop.hbase.HTableDescriptor
java_import org.apache.hadoop.hbase.TableName
java_import org.apache.hadoop.hbase.client.ConnectionFactory
java_import org.apache.hadoop.hbase.client.HBaseAdmin
java_import org.slf4j.LoggerFactory
# Name of this script
NAME = 'copy_tables_desc'.freeze
@ -64,7 +64,7 @@ end
usage if ARGV.size < 2 || ARGV.size > 3
LOG = LogFactory.getLog(NAME)
LOG = LoggerFactory.getLogger(NAME)
parts1 = ARGV[0].split(':')