The logging observer adds request-specific metadata to log lines coming out of your application.
Changed in version 1.4: Logs are now formatted as JSON objects.
No configuration is necessary, this observer is always enabled when you call
The baseplate-serve command will automatically set up log formatting.
When directly used from a TTY, a simplified human-readable message format is emitted. Only the level and message are included.
In production usage, log entries are formatted as JSON objects that can be parsed automatically by log analysis systems. Log entry objects contain the following keys:
The name of the log level at which the log entry was generated, e.g.
name, this can be useful for configuring logging to squelch noisy messages.
The name of the
level, this can be useful for configuring logging to squelch noisy messages.
The Trace ID of the request within context of which the log entry was generated. This can be used to correlate log entries from the same root request within and across services.
Only present if the log entry was generated during a request. Otherwise see
The path to the Python source for the module that generated the log entry.
The name of the module in which the log entry was generated.
The name of the function that generated the log entry.
The line number on which the log entry was generated.
The OS-level Process ID of the process that generated the log entry.
The name of the process that generated the log entry (as set on
The name of the thread that generated the log entry (as set on
This may be absent if the log entry was generated from within processing of a request, in which case
traceIDwill be included instead.
Before v1.4, log entries were written in a custom format:
^ ^ ^ ^ ^
| | | | Log message
| | | Log level
| | Name of the logger
| Trace ID of the request