What to write into log file?

后端 未结 7 1451
面向向阳花
面向向阳花 2020-12-28 09:28

My question is simple: what to write into a log. Are there any conventions? What do I have to put in?

Since my app has to be released, I\'d like to have friendly log

7条回答
  •  太阳男子
    2020-12-28 09:47

    It's quite pleasant, and already implemented.

    Read this: http://docs.python.org/library/logging.html


    Edit

    "easy to parse, read," are generally contradictory features. English -- easy to read, hard to parse. XML -- easy to parse, hard to read. There is no format that achieves easy-to-read and easy-to-parse. Some log formats are "not horrible to read and not impossible to parse".

    Some folks create multiple handlers so that one log has several formats: a summary for people to read and an XML version for automated parsing.

提交回复
热议问题