Skip to content Skip to sidebar Skip to footer

Python Logging To Different Destination Using A Configuration File

I want to use a configuration file to create two loggers which will log in two distinct files. My configuration file looks like: [loggers] keys=root,main,zipper [handlers] keys=ma

Solution 1:

The problem is that the qualified name used in the configuration file:

[logger_zipper]level=DEBUG
qualname=UPLOAD
handlers=zip

doesn't match the one used in the code:

log_z = logging.getLogger("zipper")

Use any of these combinations:

  • qualname=zipper and logging.getLogger("zipper")
  • qualname=UPLOAD and logging.getLogger("UPLOAD")

Post a Comment for "Python Logging To Different Destination Using A Configuration File"