# Define some default values that can be overridden by system properties
#hbase.root.logger=INFO,console
#hbase.security.logger=INFO,console
{% if hadoop_send_to_logstash %}
hbase.root.logger={{ hadoop_log_level }},{{ hadoop_logstash_appender }}
hbase.security.logger={{ hadoop_log_level }},{{ hadoop_logstash_appender }}
{% else %}
hbase.root.logger={{ hadoop_log_level }},{{ hadoop_logstash_appender }}
hbase.security.logger={{ hadoop_log_level }},DRFAS
{% endif %}
hbase.log.dir=.
hbase.log.file=hbase.log
# Rolling File Appender properties
hbase.log.maxfilesize={{ hadoop_log_appender_max_filesize }}
hbase.log.maxbackupindex={{ hadoop_log_appender_max_backupindex }}


# Define the root logger to the system property "hbase.root.logger".
log4j.rootLogger=${hbase.root.logger}

# Logging Threshold
log4j.threshold=ALL

#
# (fake) Daily 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}

# Rollver at midnight
#log4j.appender.DRFA.DatePattern=.yyyy-MM-dd

log4j.appender.DRFA.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.DRFA.MaxBackupIndex=${hbase.log.maxbackupindex}

log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
# Pattern format: Date LogLevel LoggerName LogMessage
log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n

# 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=org.apache.log4j.PatternLayout
log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n

# Debugging Pattern format
#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n

#
# Security audit appender
#
hbase.security.log.file=SecurityAuth.audit
log4j.appender.DRFAS=org.apache.log4j.RollingFileAppender 
log4j.appender.DRFAS.File=${hbase.log.dir}/${hbase.security.log.file}
log4j.appender.DRFAS.MaxFileSize=${hbase.log.maxfilesize}
log4j.appender.DRFAS.MaxBackupIndex=${hbase.log.maxbackupindex}
log4j.appender.DRFAS.layout=org.apache.log4j.PatternLayout
log4j.appender.DRFAS.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
log4j.category.SecurityLogger=${hbase.security.logger}
log4j.additivity.SecurityLogger=false
#log4j.logger.SecurityLogger.org.apache.hadoop.hbase.security.access.AccessController=TRACE

#
# Null Appender
#
log4j.appender.NullAppender=org.apache.log4j.varia.NullAppender

#
# 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

# Custom Logging levels

log4j.logger.org.apache.zookeeper={{ hadoop_log_level }}
log4j.logger.org.apache.hadoop.fs.FSNamesystem={{ hadoop_log_level }}
log4j.logger.org.apache.hadoop.hbase={{ hadoop_log_level }}
# Make these two classes INFO-level. Make them DEBUG to see more zk debug.
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil={{ hadoop_log_level }}
log4j.logger.org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher={{ hadoop_log_level }}
log4j.logger.org.apache.hadoop.dfs={{ hadoop_log_level }}
# 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={{ hadoop_log_level }}
# log4j.logger.org.apache.hadoop.hbase.client.MetaScanner={{ hadoop_log_level }}

{% if hadoop_send_to_logstash %}
log4j.appender.LOGSTASH=org.apache.log4j.net.SocketAppender
log4j.appender.LOGSTASH.remoteHost={{ hadoop_logstash_collector_host }}
log4j.appender.LOGSTASH.port={{ hadoop_logstash_collector_socketappender_port }}
log4j.appender.LOGSTASH.ReconnectionDelay={{ hadoop_logstash_collector_socketappender_reconndelay }}
log4j.appender.LOGSTASH.LocationInfo=true
log4j.appender.LOGSTASH.layout = org.apache.log4j.PatternLayout
log4j.appender.LOGSTASH.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
{% endif %}
