Skip to content

Add 'json_pretty_print' logging format

Compare
Choose a tag to compare
@alexberryman alexberryman released this 06 May 21:14
· 93 commits to 4.x since this release
4d04304
  • Remove exception_string from context array since the exception is now being fully normalized
  • Setting the following config value in will result logging being formatted with the JSON_PRETTY_PRINT option.
process.pool.logger.formatter.log_format: 'json_pretty_print'

This is useful to bypass docker logging driver line limits of 16KB since each new line is passed as its own record.

In practice, log messages go from looking like:

{"time":"Mon,06May1921:12:17.760256UTC","level":"notice","process_id":"78","process_path":"\/server[16]\/root[20]\/job[78]","message":"working","context":{"job_type":"complex_logging_structure","event_type":"working"},"context_json_last_error":0}

to looking like

{
    "time": "Mon, 06 May 19 21:12:17.760256 UTC",
    "level": "notice",
    "process_id": "78",
    "process_path": "\/server[16]\/root[20]\/job[78]",
    "message": "working",
    "context": {
        "job_type": "complex_logging_structure",
        "event_type": "working"
    },
    "context_json_last_error": 0
}