A brief discussion on the configuration file path problem of python logs

不言
Release: 2018-04-28 09:52:09
Original
2938 people have browsed it

The following is a brief discussion on the configuration file path of python logs. It has a good reference value and I hope it will be helpful to everyone. Let’s take a look together

As shown below:

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

Use the above python code When configuring log output, if the script is the main script (that is, it imports others, is not imported by others, and is at the top of the execution logic), the log configuration file represented by path can only be in the same directory as the script or in its subfolder. inside.

import sys
sys.path.append('..')
Copy after login

Such code only works for import modules

Related recommendations:

Detailed explanation of python log printing And write the concurrent implementation code



##

The above is the detailed content of A brief discussion on the configuration file path problem of python logs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!