ArangoDB Server Log Options
Log levels and topics
ArangoDB’s log output is grouped into topics. —log.level
can be specifiedmultiple times at startup, for as many topics as needed. The log verbosity andoutput files can be adjusted per log topic. For example
--log.level startup=trace --log.level queries=trace --log.level info
will log messages concerning startup at trace level, AQL queries at trace leveland everything else at info level.
In a configuration file, it is written like this:
[log]
level = startup=trace
level = queries=trace
level = info
The available log levels are:
fatal
: only logs fatal errorserror
: only logs errorswarning
: only logs warnings and errorsinfo
: logs information messages, warnings and errorsdebug
: logs debug and information messages, warnings and errorstrace
: logs trace, debug and information messages, warnings and errorsNote that levelsdebug
andtrace
will be very verbose.
See Log Levels in the Monitoring chapter for adetailed description of the different levels.
Some relevant log topics available in ArangoDB 3 are:
agency
: information about the agencycollector
: information about the WAL collector’s statecompactor
: information about the collection datafile compactordatafiles
: datafile-related operationsmmap
: information about memory-mapping operations (including msync)performance
: performance-related messagesqueries
: executed AQL queries, slow queriesreplication
: replication-related inforequests
: HTTP requestsstartup
: information about server startup and shutdownthreads
: information about threadsSee more log levels
Log outputs
The log option —log.output <definition>
allows directing the globalor per-topic log output to different outputs. The output definition <definition>
can be one of
-
for stdin+
for stderrsyslog://<syslog-facility>
syslog://<syslog-facility>/<application-name>
file://<relative-path>
The option can be specified multiple times in order to configure the outputfor different log topics. To set up a per-topic output configuration, use—log.output <topic>=<definition>
, e.g.
queries=file://queries.txt
logs all queries to the file “queries.txt”.
The old option —log.file
is still available in 3.0 for convenience reasons. In3.0 it is a shortcut for the more general option —log.output file://filename
.
The old option —log.requests-file
is still available in 3.0. It is now a shortcutfor the more general option —log.output requests=file://…
.
Using —log.output
also allows directing log output to different files based on topics. For example, to log all AQL queries to a file “queries.log” one can use the options:
--log.level queries=trace --log.output queries=file:///path/to/queries.log
To additionally log HTTP request to a file named “requests.log” add the options:
--log.level requests=info --log.output requests=file:///path/to/requests.log
If you specify —log.file-mode octalvalue
then any newly created logfile will use “octalvalue” as file mode. Please note that the umask
value will be applied as well.
If you specify —log.file-group name
then any newly created log filewill try to use “name” as group name. Please note that you have to bea member of that group. Otherwise the group ownership will not bechanged. Please note that this option is only available under Linuxand Mac. It is not available under Windows.
Forcing direct output
The option —log.force-direct
can be used to disable logging in an extralogging thread. If set to true
, any log messages are immediately printed in thethread that triggered the log message. This is non-optimal for performance butcan aid debugging. If set to false
, log messages are handed off to an extralogging thread, which asynchronously writes the log messages.
Time format
The option —log.time-format
controls the time format used in log output.The possible values for this option are:
Format | Example | Description |
---|---|---|
timestamp | 1553766923000 | unix timestamps, in seconds |
timestamp-millis | 1553766923000.123 | unix timestamps, in seconds, with millisecond precision |
timestamp-micros | 1553766923000.123456 | unix timestamps, in seconds, with microsecond precision |
uptime | 987654 | seconds since server start |
uptime-millis | 987654.123 | seconds since server start, with millisecond precision |
uptime-micros | 987654.123456 | seconds since server start, with microsecond precision |
utc-datestring | 2019-03-28T09:55:23Z | UTC-based date and time in format YYYY-MM-DDTHH:MM:SSZ |
utc-datestring-millis | 2019-03-28T09:55:23.123Z | like utc-datestring , but with millisecond precision |
local-datestring | 2019-03-28T10:55:23 | local date and time in format YYYY-MM-DDTHH:MM:SS |
Escaping
—log.escape value
This option toggles the escaping of log output.
If set to true
, the following characters in the log output are escaped:
- the carriage return character (hex 0d)
- the newline character (hex 0a)
- the tabstop character (hex 09)
- any other characters with an ordinal value less than hex 20If the option is set to
false
, no characters are escaped. Characters withan ordinal value less than hex 20 will not be printed in this mode but willbe replaced with a space character (hex 20).
A side effect of turning off the escaping is that it will reduce the CPU overhead for the logging. However, this will only be noticeable when loggingis set to a very verbose level (e.g. debug or trace).
The default value for this option is true
.
Color logging
—log.color value
Logging to terminal output is by default colored. Colorful logging can be turned off by setting the value to false.
Source file and Line number
Log line number: —log.line-number
Normally, if an human readable fatal, error, warning or info message islogged, no information about the file and line number is provided. Thefile and line number is only logged for debug and trace message. This optioncan be use to always log these pieces of information.
Prefix
Log prefix: —log.prefix prefix
This option is used specify an prefix to logged text.
Threads
Log thread identifier: —log.thread true
Whenever log output is generated, the process ID is written as part of thelog information. Setting this option appends the thread id of the callingthread to the process id. For example,
2010-09-20T13:04:01Z [19355] INFO ready for business
when no thread is logged and
2010-09-20T13:04:17Z [19371-18446744072487317056] ready for business
when this command line option is set.
To also log thread names, it is possible to set the —log.thread-name
option. By default —log.thread-name
is set to false
.
Role
Log role: —log.role true
When set to true
, this option will make the ArangoDB logger print a single character with the server’s role into each logged message. The roles are:
- U: undefined/unclear (used at startup)
- S: single server
- C: coordinator
- P: primary
- A: agentThe default value for this option is
false
, so no roles will be logged.