Is there a way to make Python logging using the logging
module automatically output things to stdout in addition to the log file where they are supposed to go? For example, I'd like all calls to logger.warning
, logger.critical
, logger.error
to go to their intended places but in addition always be copied to stdout
. This is to avoid duplicating messages like:
mylogger.critical("something failed")
print "something failed"
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…