I wrote a wrapper logging library on top of another logging library that uses Python's built in logging library. Below is a snippet.
import logging
class Foo(Bar):
def __init__(self):
self.logger.propagate = False
...
def info(self, msg, *args, **kwargs):
...
super().info(msg, *args, **kwargs)
class Bar:
def __init__(self):
self.logger = logging.getLogger("logger name")
def info(self, msg, *args, **kwargs):
...
self.logger.info(msg, *args, **kwargs)
### In handler.py ###
def lambda_handler(event, context):
foo = Foo()
foo.info("my msg")
However, when I use Foo
in the AWS Lambda, I end up with multiple logs like so:
I understand that the final [INFO]
log is from AWS, but why are my logs still being outputted the 2 additional times? I set propagate = False
as recommended by other questions, but it does not appear to have an effect.