Skip to content

Handler registered with addHandler not logging extra keys added by append_keys #2261

Closed Answered by heitorlessa
nimish-salve asked this question in Q&A
Discussion options

You must be logged in to vote

@leandrodamascena this related to this: #2320

addHandler goes to the superclass instead of self._logger. We could make another PR to add addHandler until we find a way around mypy to honour proxying object getters to our private logger. Right now, we recommend customers to either pass a custom logger handler at the constructor (code below), or to use our .register_formatter, .registered_handler


Bring your own handler docs section

from aws_lambda_powertools import Logger

log_file = Path("/tmp/log.json")
log_file_handler = logging.FileHandler(filename=log_file)

logger = Logger(service="payment", logger_handler=log_file_handler)

logger.info("hello world")

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nimish-salve
Comment options

@leandrodamascena
Comment options

@heitorlessa
Comment options

Answer selected by heitorlessa
@heitorlessa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants