Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass keyword arg to log handler in python logging configuration file

According to https://docs.python.org/2/library/logging.config.html#configuration-file-format I can specify arguments to the constructor of a logger, by using the args key. But this seems to work only for positional arguments. I have a handler which needs some keyword arguments. Is there a way to specify those in the config file?

like image 607
Achim Avatar asked Oct 16 '25 13:10

Achim


1 Answers

I'm sorry to tell you that the answer is no.

Have a look at https://github.com/python/cpython/blob/v2.7.18/Lib/logging/config.py#L163 for more details.

When in doubt, the source code is always your friend!

like image 85
davidedb Avatar answered Oct 19 '25 10:10

davidedb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!