How can INFO and DEBUG logging message be sent to stdout and higher level message to stderr

后端 未结 7 992
悲哀的现实
悲哀的现实 2020-12-10 00:32

Is there an easy way with python\'s logging module to send messages with a DEBUG or INFO level and the one with a higher level to different streams?

Is it a good ide

7条回答
  •  温柔的废话
    2020-12-10 01:05

    Yes. You must define multiple handlers for your logging.

    http://docs.python.org/library/logging.html#logging-to-multiple-destinations

    http://docs.python.org/library/logging.handlers.html#module-logging.handlers

提交回复
热议问题