What guidelines do you adhere to for writing good logging statements

后端 未结 7 2101
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 07:18

I recently found a log statement in my projects codebase that says \"here i am with search parameter==>===========11/30/2008===1====00:00 AM\"

what guidelines do you

相关标签:
7条回答
  • 2020-12-24 08:18

    We use "two-dimensional" logging i.e. logging by individual module and within that by level. That gives us real control when trying to debug customer problems.

    Each log entry has a unique id plus date plus time plus module plus debug level. The id is reflected (if need be) in the exception / error message displayed to the user. So if the users logs an incident, we can quickly pull up that section of the log and see what happened around that point.

    The Debug level messages don't use generalities like "Invalid input", We log the actual values that have caused the problem. If that field has relationships to other fields, we log them as well.

    0 讨论(0)
提交回复
热议问题