OrientDB Manual

Logging

OrientDB uses the Java Logging framework bundled with the Java Virtual Machine.

Supported levels are those contained in the JRE class java.util.logging.Level:

  • SEVERE (highest value)
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST (lowest value)

By default 2 loggers are installed:

  • console, as the output of the shell/command prompt that starts the application/server. Can be changed by setting the variable log.console.level
  • file, as the output to the log files. Can be changed by setting the log.file.level

Configuration file

The logging strategies and policies can be configured using a file following the Java syntax: Java Logging configuration.

Example taken from orientdb-server-log.properties:

# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler

# Set the default logging level for the root logger
.level = ALL

# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
# Set the default formatter for new ConsoleHandler instances
java.util.logging.ConsoleHandler.formatter = com.orientechnologies.common.log.OLogFormatter

# Set the default logging level for new FileHandler instances
java.util.logging.FileHandler.level = INFO
# Naming style for the output file
java.util.logging.FileHandler.pattern=../log/orient-server.log
# Set the default formatter for new FileHandler instances
java.util.logging.FileHandler.formatter = com.orientechnologies.common.log.OLogFormatter
# Limiting size of output file in bytes:
java.util.logging.FileHandler.limit=10000000
# Number of output files to cycle through, by appending an
# integer to the base file name:
java.util.logging.FileHandler.count=10

To tell to the JVM where the properties file is placed you need to set the "java.util.logging.config.file" system property to it. Example:

$ java -Djava.util.logging.config.file=mylog.properties ...

Set the logging level

To change the logging level without modify the logging configuration just set the "log.console.level" and "log.file.level" system variables to the requested levels.

In the server configuration

Open the file orientdb-server-config.xml and add or update these lines at the end of the file inside the <properties> section:

<entry value="fine" name="log.console.level" />
<entry value="fine" name="log.file.level" />

At startup

Set the system property "log.console.level" and "log.file.level" to the levels you want using the -D parameter of java.

Example:

$ java -Dlog.console.level=FINE ...

At run-time

The system variable can be setted at startup using the System.setProperty() API. Example:

public void main(String[] args){
  System.setProperty("log.console.level", "FINE");
  ...
}

Install Log formatter

OrientDB Server uses own LogFormatter. To use the same by your application call:

OLogManager.installCustomFormatter();

LogFormatter is installed automatically by Server. To disable it define the setting orientdb.installCustomFormatter to false. Example:

java ... -Dorientdb.installCustomFormatter=false=false ...