1
0
Fork 0
arangodb/Documentation/Books/Users/ConfigureArango/Logging.mdpp

288 lines
8.2 KiB
Plaintext

!CHAPTER Command-Line Options for Logging
There are two different kinds of logs. Human-readable logs and machine-readable
logs. The human-readable logs are used to provide an administration with
information about the server. The machine-readable logs are used to provide
statistics about executed requests and timings about computation steps.
!SECTION General Logging Options
!SUBSECTION Logfile
`--log.file filename`
This option allows the user to specify the name of a file to which information
is logged. By default, if no log file is specified, the standard output is
used. Note that if the file named by *filename* does not exist, it will be
created. If the file cannot be created (e.g. due to missing file privileges),
the server will refuse to start. If the specified file already exists, output is
appended to that file.
Use *+* to log to standard error. Use *-* to log to standard output.
Use *""* to disable logging to file.
`--log.tty filename`
Be default, if started on a tty, the log output will also go to the ttyp.
Use *""* to disable.
!SUBSECTION Request
<!-- lib/ApplicationServer/ApplicationServer.h -->
log file for requests
`--log.requests-file filename`
This option allows the user to specify the name of a file to which
requests are logged. By default, no log file is used and requests are
not logged. Note that if the file named by *filename* does not
exist, it will be created. If the file cannot be created (e.g. due to
missing file privileges), the server will refuse to start. If the
specified
file already exists, output is appended to that file.
Use *+* to log to standard error. Use *-* to log to standard output.
Use *""* to disable request logging altogether.
The log format is
- `"http-request"`: static string indicating that an HTTP request was
logged
- client address: IP address of client
- HTTP method type, e.g. `GET`, `POST`
- HTTP version, e.g. `HTTP/1.1`
- HTTP response code, e.g. 200
- request body length in bytes
- response body length in bytes
- server request processing time, containing the time span between
fetching
the first byte of the HTTP request and the start of the HTTP response
!SECTION Human Readable Logging
!SUBSECTION Logfiles
<!-- lib/ApplicationServer/ApplicationServer.h -->
log file
!SUBSECTION Level
`--log.level level`
`--log level`
Allows the user to choose the level of information which is logged by
the server. The argument *level* is specified as a string and can be
one of the values listed below. Note that, fatal errors, that is,
errors which cause the server to terminate, are always logged
irrespective of the log level assigned by the user. The first variant
log.level can be used in configuration files, the second variant log
for command line options.
**fatal**:
Logs errors which cause the server to terminate.
Fatal errors generally indicate some inconsistency with the manner in
which the server has been coded. Fatal errors may also indicate a
problem with the platform on which the server is running. Fatal errors
always cause the server to terminate. For example,
```
2010-09-20T07:32:12Z [4742] FATAL a http server has already been created
```
**error**:
Logs errors which the server has encountered.
These errors may not necessarily result in the termination of the
server. For example,
```
2010-09-17T13:10:22Z [13967] ERROR strange log level 'errors'\, going to
'warning'
```
**warning**:
Provides information on errors encountered by the server, which are
not necessarily detrimental to it's continued operation.
For example,
```
2010-09-20T08:15:26Z [5533] WARNING got corrupted HTTP request 'POS?'
```
**Note**: The setting the log level to warning will also result in all
errors to be logged as well.
**info**:
Logs information about the status of the server.
For example,
```
2010-09-20T07:40:38Z [4998] INFO SimpleVOC ready for business
```
**Note**: The setting the log level to info will also result in all
errors and warnings to be logged as well.
**debug**:
Logs all errors, all warnings and debug information.
Debug log information is generally useful to find out the state of the
server in the case of an error. For example,
```
2010-09-17T13:02:53Z [13783] DEBUG opened port 7000 for any
```
**Note**: The setting the log level to debug will also result in all
errors, warnings and server status information to be logged as well.
**trace**:
As the name suggests, logs information which may be useful to trace
problems encountered with using the server.
For example,
```
2010-09-20T08:23:12Z [5687] TRACE trying to open port 8000
```
**Note**: The setting the log level to trace will also result in all
errors, warnings, status information, and debug information to be
logged as well.
!SUBSECTION Local Time
<!-- lib/ApplicationServer/ApplicationServer.h -->
log dates and times in local time zone
`--log.use-local-time`
If specified, all dates and times in log messages will use the server's
local time-zone. If not specified, all dates and times in log messages
will be printed in UTC / Zulu time. The date and time format used in logs
is always `YYYY-MM-DD HH:MM:SS`, regardless of this setting. If UTC time
is used, a `Z` will be appended to indicate Zulu time.
!SUBSECTION Line number
<!-- lib/ApplicationServer/ApplicationServer.h -->
log line number
`--log.line-number`
Normally, if an human readable fatal, error, warning or info message is
logged, no information about the file and line number is provided. The
file
and line number is only logged for debug and trace message. This option
can
be use to always log these pieces of information.
!SUBSECTION Prefix
<!-- lib/ApplicationServer/ApplicationServer.h -->
log prefix
`--log.prefix prefix`
This option is used specify an prefix to logged text.
!SUBSECTION Thread
<!-- lib/ApplicationServer/ApplicationServer.h -->
log thread identifier
`--log.thread`
Whenever log output is generated, the process ID is written as part of the
log information. Setting this option appends the thread id of the calling
thread 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.
!SUBSECTION Content Filter
<!-- lib/ApplicationServer/ApplicationServer.h -->
log content filter
`--log.content-filter arg`
Only log message containing the specified string *arg*.
!SUBSECTION Performance
<!-- lib/ApplicationServer/ApplicationServer.h -->
performance logging
`--log.performance`
If this option is set, performance-related info messages will be logged
via
the regular logging mechanisms. These will consist of mostly timing and
debugging information for performance-critical operations.
Currently performance-related operations are logged as INFO messages.
Messages starting with prefix `[action]` indicate that an instrumented
operation was started (note that its end won't be logged). Messages with
prefix `[timer]` will contain timing information for operations. Note that
no timing information will be logged for operations taking less time than
1 second. This is to ensure that sub-second operations do not pollute
logs.
The contents of performance-related log messages enabled by this option
are subject to change in future versions of ArangoDB.
!SECTION Machine Readable Logging
!SUBSECTION Application
<!-- lib/ApplicationServer/ApplicationServer.h -->
log application name
`--log.application name`
Specifies the *name* of the application which should be logged if this
item of
information is to be logged.
!SUBSECTION Facility
<!-- lib/ApplicationServer/ApplicationServer.h -->
log facility
`--log.facility name`
If this option is set, then in addition to output being directed to the
standard output (or to a specified file, in the case that the command line
log.file option was set), log output is also sent to the system logging
facility. The *arg* is the system log facility to use. See syslog for
further details.
The value of *arg* depends on your syslog configuration. In general it
will be *user*. Fatal messages are mapped to *crit*, so if *arg*
is *user*, these messages will be logged as *user.crit*. Error
messages are mapped to *err*. Warnings are mapped to *warn*. Info
messages are mapped to *notice*. Debug messages are mapped to
*info*. Trace messages are mapped to *debug*.