简体   繁体   中英

Python logging how do i it create empty log file?

How do I stop logging to create a log file when there is no log message? Currently, the logger has created an empty log when even no logging message to it. Use case is I created a FileHandler that only log error (by logger.error("I am error!") ), but I don't want it to create a file when there is no error.

文档说通过delay=True在第一次emit调用时创建文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM