Updated on 2024-10-23 GMT+08:00

Configuring Log4j Log Output

Function Description

This section describes how to output HBase client logs to a specified log file separately from service logs to facilitate HBase problem analyzing and locating.

If the log4j configuration exists in the process, copy the RFA and RFAS configurations in hbase-example\src\main\resources\log4j.properties to the existing log4j configuration.

Sample Code

The following is a code snippet:

hbase.root.logger=INFO,console,RFA              //HBase client log output configuration. console: outputs to the console; RFA: outputs to the log files.
hbase.security.logger=DEBUG,console,RFAS        //HBase client security logs output configuration. console: outputs to the console; RFAS: outputs the log files.
hbase.log.dir=/var/log/Bigdata/hbase/client/    //Log directory. Modify based on the actual directory. Ensure that the directory has the write permission.
hbase.log.file=hbase-client.log                 //Log file name
hbase.log.level=INFO                            //Log level. If detailed logs are required for fault locating, change it to DEBUG. The modification takes effect after restart.
hbase.log.maxbackupindex=20                     //Maximum number of log files that can be saved.
# Security audit appender 
hbase.security.log.file=hbase-client-audit.log  //Command of the audit log file