Answers for "python logging basicconfig stdout"

1

python logging basicconfig stdout

# https://stackoverflow.com/a/14058475
import logging
import sys

root = logging.getLogger()
root.setLevel(logging.DEBUG)

handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
Posted by: Guest on May-02-2021

Code answers related to "python logging basicconfig stdout"

Python Answers by Framework

Browse Popular Code Answers by Language