Splice Machine Logging

This topic describes the logging facility used in Splice Machine. Splice Machine also allows you to exercise direct control over logging in your database. This topic contains these sections:

Using Logging

Splice Machine uses the open source Apache log4j Logging API, which allows you to associate a logger object with any java class, among other features. Loggers can be set to capture different levels of information.

Splice Machine enables statement logging by default.

Logging too much information can slow your system down, but not logging enough information makes it difficult to debug certain issues. The Splice Machine Loggers section below summarizes the loggers used by Splice Machine and the system components that they use. You can use the SQL logging functions described in the SQL Logger Functions section below to retrieve or modify the logging level of any logger used in Splice Machine.

The remainder of this section shows you how to:

Masking Sensitive Information

You can configure log4j to prevent sensitive information such as passwords and credit card information from being logged in log messages. To do so, you:

  • Use the com.splicemachine.utils.logging.MaskPatternLayout log4j layout pattern.
  • Specify a regular expression in MaskPattern that matches the part of log messages you want matched. * When logging with this layout, log4j will replace any text that matches the filter with this text:

    MASKED SENSITIVE INFO

For example:

log4j.appender.spliceDerby.layout=com.splicemachine.utils.logging.MaskPatternLayoutlog4j.appender.spliceDerby.layout.ConversionPattern=%d{ISO8601} Thread[%t] %m%nlog4j.appender.spliceDerby.layout.MaskPattern=insert (?:.*) ([0-9]+),([0-9]+)

Given that layout, the following statement:

splice> INSERT INTO a VALUES myName, myPassword

will be logged as:

INSERT INTO a VALUES MASKED SENSITIVE INFO, MASKED SENSITIVE INFO

Manually Disabling Logging

Logging of SQL statements is automatically enabled in Splice Machine; to disable logging of statements, you can do so in either of these ways:

  • You can pass an argument to your Splice Machine JVM startup script, as follows:

    -Dderby.language.logStatementText=false
    
  • You can add the following property definition to your hbase-default.xml, hbase-site.xml, or splice-site.xml file:

    <property>
    <name>splice.debug.logStatementContext</name>
    <value>false</value>
    <description>Property to enable logging of all statements.</description>
    </property>
    

You can examine the logged data in your region server’s logs; if you want to change the location where events are logged, see the instructions in the Installation Guide for your platform (Cloudera, Hortonworks, or MapR).

Logger Levels

The log4j API defines six logger levels:

  • If the logger is currently configured to record messages at the specified level, the message is added to the log; otherwise, the logger ignores the message.
  • Logger levels are ordered hierarchically: any message with a level equal to or greater than the hierarchical level for which logging is enabled is recorded into the log.

The following table displays the logger levels from lowest level to the highest:

Logger Level What gets logged for a logger object set to this level
TRACE Captures all messages.
DEBUG Captures any message whose level is DEBUG, INFO, WARN, ERROR, or FATAL.
INFO Captures any message whose level is INFO, WARN, ERROR, or FATAL.
WARN Captures any message whose level is WARN, ERROR, or FATAL.
ERROR Captures any message whose level is ERROR or FATAL.
FATAL Captures only messages whose level is FATAL.

Splice Machine Loggers

The following table summarizes the loggers used in the Splice Machine environment that might interest you if you’re trying to debug performance issues in your database:

Logger Name Default Level Description
org.apache ERROR Logs all Apache software messages
com.splicemachine.db WARN Logs all Derby software messages
com.splicemachine.db.shared.common.sanity ERROR Logs all Derby Sanity Manager messages
com.splicemachine.derby.impl.sql.catalog WARN Logs Derby SQL catalog/dictionary messages
com.splicemachine.db.impl.sql.execute.operations WARN Logs Derby SQL operation messages
org.apache.zookeeper.server.ZooKeeperServer INFO Used to determine when Zookeeper is started
org.apache.zookeeper.server.persistence.FileTxnSnapLog INFO Logs Zookeeper transactions
com.splicemachine WARN By default, controls all Splice Machine logging
com.splicemachine.derby.hbase.SpliceDriver INFO Prints start-up and shutdown messages to the log and to the console
com.splicemachine.derby.management.StatementManager ERROR Set the level of this logger to TRACE to record execution time for SQL statements

To see a full list of loggers, use the SYSCS_UTIL.SYSCS_GET_LOGGERS system procedure:

   CALL SYSCS_UTIL.SYSCS_GET_LOGGERS();

SQL Logger Functions

Splice Machine SQL includes the following built-in system procedures, all documented in our SQL Reference Manual, for interacting with the Splice Machine logs:

System Procedure Description
SYSCS_UTIL.SYSCS_GET_LOGGERS Displays a list of the active loggers.
SYSCS_UTIL.SYSCS_GET_LOGGER_LEVEL Displays the current logging level of the specified logger.
SYSCS_UTIL.SYSCS_SET_LOGGER_LEVEL Sets the current logging level of the specified logger.

See Also