What is Python's default logging formatter?

后端 未结 5 1610
有刺的猬
有刺的猬 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:56

    import logging
    print(logging.BASIC_FORMAT)
    

    Old thread but this comes up first in my google search results for the query "python logging default format", so I thought I should add my answer.

    Also some comments asked about how one could have come to discover this on their own. Here is a natural thing to do:

    import logging
    print(dir(logging))
    

    BASIC_FORMAT is in there, in fact it is the first entry in the result in my case.

提交回复
热议问题