Commons Logging priority best practices

前端 未结 6 1085
一个人的身影
一个人的身影 2021-02-05 15:59

This may be a purely subjective question (if no organization has attempted to standardize this), but my team struggles with this more than you would think.

We use Apache

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 16:27

    This is what my company recommends:

    TRACE - Messages probably only useful during the development cycle, and possibly generated far too frequently for suitable use in production. For example, if I were logging intermediate values in an inner loop, I’d use TRACE.

    DEBUG - Messages used to log various steps in the normal running of the server. Typically these would be aimed at developers rather than operations staff.

    INFO - Messages of a positive or neutral nature which we would expect to be logged in a production environment. Should be meaningful to operations staff.

    WARN - Messages indicating a condition possibly endangering the ability of the server to respond to requests in an accurate and timely fashion.

    ERROR - Messages indicating an unexpected behaviour or condition.

    FATAL - Messages indicating an unexpected behaviour or condition which leaves the continued running of the application process impossible or dangerous.

    We expect the logs in production to be set at INFO, and we expect them to be read by people other than the developers. Style of log messages is a whole other conversation...

提交回复
热议问题