Discussion on the configuration file path of python log

  • 2020-08-22 22:16:38
  • OfStack

As shown below:


import logging
import logging.config
logging.config.fileConfig(path)
logger = logging.getLogger('')

When configuring log output with the above python code, if the script is the master script (i.e. import others, not import, at the top of the execution logic), the log profile represented by path can only be in the same directory or in its subfolders with the script.


import sys
sys.path.append('..')

This code only works for the import module


Related articles: