pythonlogging

How to get file the Python logging module is currently logging to?


Is there a way to do this? If logging.config.fileConfig('some.log') is the setter, what's the getter? Just curious if this exists.


Solution

  • logging.config.fileConfig('some.log') is going to try to read logging configuration from some.log.

    I don't believe there is a general way to retrieve the destination file -- it isn't always guaranteed to even be going to a file. (It may go to syslog, over the network, etc.)