简体   繁体   中英

How can I disable a python program from logging (externally)?

There is a python program that I want to run without modification, but I want to stifle logging. However, the program doesn't expose access to logging settings via command line arguments. Is there any way to get rid of logging output but retain the normal output of the program when I run the file?

The best solution I can think of is to wrap the file in another file that disables logging, but I'd like to stifle logging output directly when running the file if possible.

import logging logging.disable(logging.CRITICAL)

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