I have a log configured from a file, and I would like to change the level of my logging without changing the .conf file, but using the built-in code instead;
import logging.config
logging.config.fileConfig('..\\LoggingConfig\\loggingfile.conf')
logging.StreamHandler.setLevel(logging.info)
logging.debug("Debug")
logging.info("Info")
This should print only the line of the "Information" log on the screen. I do not know on what object setLevel () can be called! logging.StreamHandler.setLevel (logging.info) is just a hit in the dark after looking for 30 minutes ...
File loggingfile.conf;
[loggers]
keys=root
[logger_root]
handlers=screen
level=NOTSET
[formatter_modfunc]
format=%(module)-20s %(funcName)-25s %(levelno)-3s: %(message)s
[handlers]
keys=screen
[handler_screen]
class=StreamHandler
formatter=modfunc
level=DEBUG
args=(sys.stdout,)
qualname=screen
source
share