Logging configuration

Dgraph Gateway has a default Log4j configuration file that sets its logging properties.

The file is named EndecaServerLog4j.properties and is located in the $DOMAIN_HOME/config directory.

The default version of the file is as follows:
log4j.rootLogger=WARN, stdout, ODL

# Console Appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%p] [%c] %L - %m%n

# ODL-format Log Appender
log4j.appender.ODL=com.endeca.util.ODLAppender
log4j.appender.ODL.MaxSize=104857600
log4j.appender.ODL.MaxSegmentSize=10485760
log4j.appender.ODL.encoding=UTF-8

# Log level per packages
log4j.logger.com.endeca=ERROR
log4j.logger.org.apache.zookeeper=WARN

The file defines two appenders (stdout and ODL) for the root logger and also sets log levels for two packages.

The file has the following properties:
Logging property Description
log4j.rootLogger=WARN, stdout, ODL The level of the root logger is defined as WARN and attaches the Console Appender (stdout) and ODL-format Log Appender (ODL) to it.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender Defines stdout as a Log4j ConsoleAppender
org.apache.log4j.PatternLayout Sets the PatternLayout class for the stdout layout.
log4j.appender.stdout.layout.ConversionPattern Defines the log entry conversion pattern as:
  • %d is the date of the logging event.
  • %p outputs the priority of the logging event.
  • %c outputs the category of the logging event.
  • %L outputs the line number from where the logging request was issued.
  • %m outputs the application-supplied message associated with the logging event while %n is the platform-dependent line separator character.

For other conversion characters, see: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html

log4j.appender.ODL=com.endeca.util.ODLAppender Defines ODL as an ODL Appender. ODL (Oracle Diagnostics Logging) is the logging format for Oracle applications.
log4j.appender.ODL.MaxSize Sets the maximum amount of disk space to be used by the <ServerName>-diagnositic.log file and the logging rollover files. The default is 104857600 (about 100 MB).
log4j.appender.ODL.MaxSegmentSize Sets the maximum size (in bytes) of the log file. When the <ServerName>-diagnositic.log file reaches this size, a rollover file is created. The default is 104857600 (about 10 MB).
log4j.appender.ODL.encoding Sets character encoding the log file. The default UTF-8 value prints out UTF-8 characters in the file.
log4j.logger.com.endeca Sets the default log level for the Endeca logger. ERROR is the default log level.
log4j.logger.org.apache.zookeeper Sets the default log level for the ZooKeeper logger. WARN is the default log level.

For details on the FileHandler settings, see http://docs.oracle.com/javase/7/docs/api/java/util/logging/FileHandler.html

Logging levels

The logging level specifies the amount of information that is logged. This example shows how you can change a log level setting:
log4j.logger.com.endeca=INFO

In the example, the log level for the Endeca logger is set to INFO.

The log levels (in decreasing order of severity) are:
  • OFF — Has the highest possible rank and is used to turn off logging.
  • FATAL — Indicates a serious failure. In general, FATAL messages describe events that are of considerable importance and which will prevent normal program execution.
  • ERROR — Indicates a serious problem that requires immediate attention from the administrator and is not caused by a bug in the product.
  • WARN — Indicates a potential problem. In general, WARN messages describe events that should be reviewed by the administrator.
  • INFO — A message level for informational messages. The INFO level typically indicates a major lifecycle event such as the activation or deactivation of a primary sub-component or feature.
  • DEBUG — Debug information for events that are meaningful to administrators, such as public API entry or exit points.

These levels allow you to monitor events of interest at the appropriate granularity without being overwhelmed by messages that are not relevant. When you are initially setting up your application in a development environment, you might want to use the DEBUG level to get all messages, and change to a less verbose level in production.

Note that restarting the Dgraph Gateway is required after the log properties file has been modified.