Skip to content

Enabling DD_LOGS_INJECTION messes up log format and drops extra logging data #153

Closed
@fdesoye

Description

@fdesoye

Expected Behavior

In our code we have nicely formatted JSON logs as recommended in https://docs.datadoghq.com/logs/log_collection/python/?tab=jsonlogformatter
We inject quite a bunch of data in the logging extra kwarg to be able to search for logs efficiently. Injecting the tracing information by setting DD_LOGS_INJECTION=True should not mess with this log format or at least include all information that got passed as extra.

Actual Behavior

As soon as we enable DD_LOGS_INJECTION, the log format is changed to a single line log format. This format only includes the original message and the tracing information but drops the information we pass in extra.

Steps to Reproduce the Problem

  1. configure your logging as recommended in https://docs.datadoghq.com/logs/log_collection/python/?tab=jsonlogformatter
  2. log something by providing additional logging information in the extra keyword.
  3. check logs. they should be nice json with all data provided in extra
  4. set DD_LOGS_INJECTION=True
  5. log something by providing additional logging information in the extra keyword.
  6. check logs. they should be nice json with all data provided in extra but only logging message is included and log format changed to single Line

Specifications

  • Datadog Lambda Layer version:
  • Python version: 3.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions