Since the default handler's filter injects the aws_request_id
into the record, if you remove the default handler, you will not be able to retrieve aws_request_id
. Therefore, instead of removing the default handler and adding your own, you should just modify the formatter using setFormatter
.
Also you can see the code of default handler and filter https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/849e874de01776cb386c18fb2c1731d43cd2b2f4/awslambdaric/bootstrap.py#L339C1-L342C20