Skip to content

Duplicate logs: structured and unstructured #115

Closed
@Nxtra

Description

@Nxtra

My logs are appearing twice in CloudWatch: once in a structured format and once unstructured.
I'd only like to have the structured logs.
I didn't see this behavior before so it might be something on my side.

Expected Behavior

Having the logs once in structured format.

Current Behavior

Having the logs both structured and unstructured.

Environment

  • Powertools version used: 1.1.2
  • AWS Lambda function runtime: Python
  • Debugging logs

Powertools is setup like this:

from aws_lambda_powertools import Logger, Tracer, Metrics
from aws_lambda_powertools.metrics import MetricUnit

logger = Logger()
tracer = Tracer()
metrics = Metrics()

@metrics.log_metrics
@logger.inject_lambda_context
@tracer.capture_lambda_handler
def handle(event, context):
   ...
   logger.info('validated')

I am seeing the logs twice:
image

Seems like the root logger is still capturing and logging.

Why do I have duplicate logs? What am I missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions