What is Python's default logging formatter?

后端 未结 5 1621
有刺的猬
有刺的猬 2021-02-05 01:02

I\'m trying to decipher the information contained in my logs (the logging setup is using the default formatter). The documentation states:

Do formatting f

5条回答
  •  庸人自扰
    2021-02-05 01:42

    The default seems to be %(levelname)s:%(name)s:%(message)s

    import logging
    logging.error("Some error")
    print "fmt: " , logging.root.handlers[0].formatter._fmt
    # ERROR:root:Some error
    # fmt:  %(levelname)s:%(name)s:%(message)s
    

提交回复
热议问题