对于hadoop hbase集群,我想覆盖 log4j
输出特定类的日志 org.apache.hadoop.hbase.tool.Canary
到控制台。
目前 log4j.properties
对于hbase应用程序,文件如下所示:
hbase.root.logger=INFO,RFA,RFAE
hbase.log.dir=.
hbase.log.file=hbase.log
# Define the root logger to the system property "hbase.root.logger".
log4j.rootLogger=${hbase.root.logger}
# Logging Threshold
log4j.threshold=ALL
# Rolling File Appender properties
hbase.log.maxfilesize=128MB
hbase.log.maxbackupindex=10
hbase.log.layout=org.apache.log4j.PatternLayout
hbase.log.pattern=%d{ISO8601} %p %c: %m%n
#
# Daily Rolling File Appender
# Hacked to be the Rolling File Appender
# Rolling File Appender
log4j.appender.DRFA=org.apache.log4j.RollingFileAppender
log4j.appender.DRFA.File=${hbase.log.dir}/${hbase.log.file}
log4j.appender.DRFA.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.DRFA.MaxBackupIndex=${hbase.log.maxbackupindex}
log4j.appender.DRFA.layout=${hbase.log.layout}
log4j.appender.DRFA.layout.ConversionPattern=${hbase.log.pattern}
log4j.appender.DRFA.Append=true
# Rolling File Appender
log4j.appender.RFA=org.apache.log4j.RollingFileAppender
log4j.appender.RFA.File=${hbase.log.dir}/${hbase.log.file}
log4j.appender.RFA.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.RFA.MaxBackupIndex=${hbase.log.maxbackupindex}
log4j.appender.RFA.layout=${hbase.log.layout}
log4j.appender.RFA.layout.ConversionPattern=${hbase.log.pattern}
log4j.appender.RFA.Append=true
#
# console
# Add "console" to rootlogger above if you want to use this
#
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
#
# Error log appender, each log event will include hostname
#
hbase.error.log.file=hbase_error.log
log4j.appender.RFAE=org.apache.log4j.RollingFileAppender
log4j.appender.RFAE.File=${hbase.log.dir}/${hbase.error.log.file}
log4j.appender.RFAE.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.RFAE.MaxBackupIndex=${hbase.log.maxbackupindex}
log4j.appender.RFAE.layout=org.apache.log4j.PatternLayout
log4j.appender.RFAE.layout.ConversionPattern=%d{ISO8601} data-analytics1-data-namenode-dev-001 %p %c: %m%n
log4j.appender.RFAE.Threshold=ERROR
log4j.appender.RFAE.Append=true
# Custom Logging levels
org.apache.hadoop.hbase.regionserver.compactions.CompactionProgress=DEBUG
log4j.logger.org.apache.zookeeper=WARN
# log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG
log4j.logger.org.apache.hadoop.hbase=INFO
# Make these two classes INFO-level. Make them DEBUG to see more zk debug.
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=WARN
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher=WARN
# Snapshot Debugging
log4j.logger.org.apache.hadoop.hbase.regionserver.snapshot=DEBUG
# log4j.logger.org.apache.hadoop.dfs=DEBUG
# Set this class to log INFO only otherwise its OTT
# Uncomment this line to enable tracing on _every_ RPC call (this can be a lot of output)
# log4j.logger.org.apache.hadoop.ipc.HBaseServer.trace=DEBUG
# Uncomment the below if you want to remove logging of client region caching'
# and scan of .META. messages
# log4j.logger.org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation=INFO
# log4j.logger.org.apache.hadoop.hbase.client.MetaScanner=INFO
请告知。谢谢!
1条答案
按热度按时间xzlaal3s1#
将以下行添加到
log4j.properties
:你可以改变
INFO
到这个类需要的任何日志级别。如果您还想阻止该类使用其他appender,请通过添加以下行来更改该类的可加性: