Expected Behaviour
Cloning Logger config to all other registered standard loggers - example in FAQ should not have any errors
Current Behaviour
Running the provided snippet results in the following error

Code snippet
import logging
from aws_lambda_powertools import Logger
from aws_lambda_powertools.logging import utils
logger = Logger()
external_logger = logging.logger()
utils.copy_config_to_registered_loggers(source_logger=logger)
external_logger.info("test message")
Possible Solution
Use the correct method getLogger and the code will run, see PR #1121 for a fix and visit https://gyft.github.io/aws-lambda-powertools-python/latest/core/logger/#faq for a deployed version of the docs
import logging
from aws_lambda_powertools import Logger
from aws_lambda_powertools.logging import utils
logger = Logger()
external_logger = logging.getLogger(name="example")
utils.copy_config_to_registered_loggers(source_logger=logger)
external_logger.info("test message")
Now the output is:
{"level":"INFO","location":"<module>:11","message":"test message","timestamp":"2022-05-17 20:41:19,810-0700","service":"service_undefined"}
Steps to Reproduce
- Go to https://awslabs.github.io/aws-lambda-powertools-python/latest/core/logger/#faq
- Copy code example for
Cloning Logger config to all other registered standard loggers
- Run the example code
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
Expected Behaviour
Cloning Logger config to all other registered standard loggers- example in FAQ should not have any errorsCurrent Behaviour
Running the provided snippet results in the following error
Code snippet
Possible Solution
Use the correct method
getLoggerand the code will run, see PR #1121 for a fix and visit https://gyft.github.io/aws-lambda-powertools-python/latest/core/logger/#faq for a deployed version of the docsNow the output is:
{"level":"INFO","location":"<module>:11","message":"test message","timestamp":"2022-05-17 20:41:19,810-0700","service":"service_undefined"}Steps to Reproduce
Cloning Logger config to all other registered standard loggersAWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs