Skip to content

LoggerConfig

Thiago da Rosa de Bustamante edited this page Mar 27, 2018 · 5 revisions

Describes the configuration for the Log system.

It support the following properties:

Property Type Description Required
level 'error', 'warn', 'info' or 'debug' Configure the minimum log level. false
console LogConsoleConfig Configure a Console reporter for the log system. false
file LogFileConfig Configure a File reporter for the log system. false

LogConsoleConfig

Configurations for the Console reporter of the Gateway Log system.

It support the following properties:

Property Type Description Required
level 'error', 'warn', 'info' or 'debug' Configure the minimum log level for this reporter. false
timestamp boolean Flag indicating if we should prepend output with timestamps (default true). false
silent boolean Flag indicating whether to suppress output. false
colorize boolean Flag indicating if we should colorize output. false
json boolean Flag indicating if messages should be logged as JSON (default true). false
stringify boolean Flag indiciating if the output should be passed through JSON.stringify, resulting in single-line output. Most useful when used in conjunction with the json flag. (default false). false
prettyPrint boolean If true, additional JSON metadata objects that are added to logging string messages will be displayed as a JSON string representation. false
depth number Numeric indicating how many times to recurse while formatting the object with util.inspect (only used with prettyPrint: true) (default null, unlimited). false
humanReadableUnhandledException boolean Flag indicating if uncaught exception should be output as human readable, instead of a single line. false
showLevel boolean Flag indicating if we should prepend output with level (default true). false
stderrLevels string[] Array of strings containing the levels to log to stderr instead of stdout, for example ['error', 'debug', 'info']. (default ['error', 'debug']). false

LogFileConfig

Configurations for the File reporter of the Gateway Log system.

It support the following properties:

Property Type Description Required
level 'error', 'warn', 'info' or 'debug' Configure the minimum log level for this reporter. false
outputDir string The directory name where the log files will be saved. false
timestamp boolean Flag indicating if we should prepend output with timestamps (default true). false
silent boolean Flag indicating whether to suppress output. false
colorize boolean Flag indicating if we should colorize output. false
json boolean Flag indicating if messages should be logged as JSON (default true). false
stringify boolean Flag indiciating if the output should be passed through JSON.stringify, resulting in single-line output. Most useful when used in conjunction with the json flag. (default false). false
prettyPrint boolean If true, additional JSON metadata objects that are added to logging string messages will be displayed as a JSON string representation. false
depth number Numeric indicating how many times to recurse while formatting the object with util.inspect (only used with prettyPrint: true) (default null, unlimited). false
humanReadableUnhandledException boolean Flag indicating if uncaught exception should be output as human readable, instead of a single line. false
showLevel boolean Flag indicating if we should prepend output with level (default true). false
stderrLevels string[] Array of strings containing the levels to log to stderr instead of stdout, for example ['error', 'debug', 'info']. (default ['error', 'debug']). false
maxsize number Max size in bytes of the log file, if the size is exceeded then a new file is created, a counter will become a suffix of the log file. false
maxFiles number Limit the number of files created when the size of the log file is exceeded. false
eol string String indicating the end-of-line characters to use (default to \n). false
logstash boolean If true, messages will be logged as JSON and formatted for logstash (default false). false
tailable boolean If true, log files will be rolled based on maxsize and maxfiles, but in ascending order. The filename will always have the most recent log lines. The larger the appended number, the older the log file. This option requires maxFiles to be set, or it will be ignored. false
maxRetries number The number of stream creation retry attempts before entering a failed state. In a failed state the transport stays active but performs a NOOP on it's log function. (default 2). false
zippedArchive boolean If true, all log files but the current one will be zipped. false

Example:

{
    "logger": {
        "level": "info",
        "console": {
            "level": "error",
            "colorize": true
        },
        "file": {
            "timestamp": true,
            "outputDir": "./logs",
            "json": false, 
            "prettyPrint": true 
        }
    }
}

or

logger:
  level: info
  console:
    level: error
    colorize: true
  file:
    timestamp: true
    outputDir: "./logs"
    json: false
    prettyPrint: true
Clone this wiki locally