I\'m currently working on a python project and I set up logging using a config file. It has already worked and was logging my messages as wanted.
But then, after rearran
d512 was correct. And when running the code and based on the PYTHONPATH, Python treats your project root directory as the 'current path' no matter where is your running file located. So another way is to add the relative path either as following:
logging.config.fileConfig('root_path_of_project/.../logging.conf')
or relative to the current file:
LOGGING_CONFIG = Path(__file__).parent / 'logging.conf'
...
logging.config.fileConfig(LOGGING_CONFIG)
Hope it helps