Skip to content

LogRecords should not format variables into message #2801

@fdemmer

Description

@fdemmer

The msg of logging calls should be format strings and not include variables.

msg – The event description message, possibly a format string with placeholders for variable data.

https://docs.python.org/3/library/logging.html#logrecord-objects

One example is at

self.log.warning("Worker graceful timeout (pid:%s)" % self.pid)

Pre-formatting variables into the msg prevents aggregation of logs in tools/services like sentry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions