Global default logging is configured via the
The supported levels are:
fatal- The program will exit when this level of logging is output.
error- General errors, the program runs normally.
warn- warnings that you should be noticed.
info- general infos.
debug- Output more information than
infolevel, used to locate problems during development or use.
trace- More information than
debuglevel output, useful for development debugging.
The default level is
debug level can be set through the
-D parameter on the command line, or the corresponding level can be set through the environment variable
The log supports
text formats, the default is
The supported output methods are:
none- Discard the log without outputting any information.
stderr- standard error stream.
stdout- Standard output stream.
/path/to/file- The specified file path.
Defaults to output to the standard error stream (
Logs can be split, backed up and compressed by configuring the
rotation option. Valid when
output is a file.
- The maximum size in megabytes of the log file before it gets rotated. It defaults to 100 megabytes.
- The maximum number of days to retain old log files based on the timestamp encoded in their filename. Note that a day is defined as 24 hours and may not exactly correspond to calendar days due to daylight savings, leap seconds, etc. The default is not to remove old log files based on age.
- the maximum number of old log files to retain. The default is to retain all old log files (though
maxAgemay still cause them to get deleted.)
- Determines if the time used for formatting the timestamps in backup files is the computer's local time. The default is to use UTC time.
- Determines if the rotated log files should be compressed using gzip. The default is not to perform compression.
A logger is a configuration definition of a logging instance. In addition to the default global logging, any number of different logging instances can be defined.
Loggers can be used at the service level to configure logging policies individually for each service.
services: - name: service-0 addr: :8000 logger: logger-0 handler: type: auto listener: type: tcp - name: service-1 addr: :8001 logger: logger-1 handler: type: auto listener: type: tcp loggers: - name: logger-0 log: level: info format: text output: stderr - name: logger-1 log: level: debug format: json output: /path/to/file rotation: maxSize: 100 maxAge: 10 maxBackups: 3 localTime: false compress: false