Skip to content

Bug: Unexpected warning about persistentLogAttributes usage #4624

@alex-karo

Description

@alex-karo

Expected Behavior

The warning shouldn't appear if persistentLogAttributes is not used

Current Behavior

The warning appears if I pass persistentKeys into createChild function.

P.S. It works well if I call appendPersistentKeys separately

Code snippet

const logger = new Logger();
const child = logger.createChild({persistentKeys: {key: 'value'}});

Output:

{"level":"WARN","message":"Both persistentLogAttributes and persistentKeys options were provided. Using persistentKeys as persistentLogAttributes is deprecated and will be removed in future releases","timestamp":"2025-10-08T16:01:25.851Z","service":"service_undefined","sampling_rate":0,"key":"value"}

Steps to Reproduce

  1. Create Logger
  2. Create a child with persistentKeys param

Possible Solution

  1. Do not set the default empty object to persistentLogAttributes
  2. Or change the warning condition

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

22.x

Packaging format used

npm

Execution logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingconfirmedThe scope is clear, ready for implementationloggerThis item relates to the Logger Utility

Type

No type

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions