Logging properties file

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 log rotation frequency is set to daily (it is hard-coded, not configurable). This means that a new log file is created either when the log file reaches a certain size (the MaxSegmentSize setting) or when a particular time is reached (it is 00:00 UTC for Dgraph Gateway).

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.server.logging.ODLAppender
log4j.appender.ODL.MaxSize=1048576000
log4j.appender.ODL.MaxSegmentSize=104857600
log4j.appender.ODL.encoding=UTF-8
log4j.appender.ODL.MaxDaysToRetain=7

# Zookeeper client log level
log4j.logger.org.apache.zookeeper=WARN

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

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 1048576000 (about 1GB). Older log files are deleted to keep the total log size under the given limit.
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.appender.ODL.MaxDaysToRetain Sets how long (in days) older log file should be kept. Files that are older than the given days are deleted. Files are deleted only when there is a log rotation. As a result, files may not be deleted for some time after the retention period expires. The value must be a positive integer. The default is 7 days.
log4j.logger.org.apache.zookeeper Sets the default log level for the ZooKeeper client logger (i.e., not for the ZooKeeper server that is running on the Hadoop environment). WARN is the default log level.

Changing the ZooKeeper client log level

You can change the ZooKeeper client log level to another setting, as in this example:
log4j.logger.org.apache.zookeeper=INFO
The valid log levels (in decreasing order of severity) are:
  • OFF
  • FATAL
  • ERROR
  • WARN
  • INFO
  • DEBUG