generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Per the lambda best practices, trying to enable structured logging
https://awslabs.github.io/aws-lambda-powertools-python/2.5.0/core/logger/#how-can-i-enable-powertools-logging-for-imported-libraries
from aws_lambda_powertools.logging.logger import Logger
from aws_lambda_powertools.logging import utils
logger = Logger(service='appFlow_Connector')
utils.copy_config_to_registered_loggers(source_logger=logger)But because this line in the SDK does not specify a logger name and implicitly uses the root logger, the power tools configuration can't apply the logger configuration to it. Hence logs are output in text format rather than JSON.
def lambda_handler(self, event, context):
logger = logging.getLogger()
logger.setLevel(logging.INFO)Metadata
Metadata
Assignees
Labels
No labels