Code to logging ratio? [closed]

Since log4net does a great job at not clogging up the resources, I tend to be a little verbose on logging because when you have to change to debug mode, the more info you have, the better. Here’s what I typically log:

DEBUG Level

  • Any parameters passed into the
    method
  • Any row counts from result sets I retrieve
  • Any datarows that may contain suspicious data when being passed down to the method
  • Any “generated” file paths, connection strings, or other values that could get mungled up when being “pieced together” by the environment.

INFO Level

  • The start and end of the method
  • The start and end of any major loops
  • The start of any major case/switch statements

ERROR Level

  • Handled exceptions
  • Invalid login attempts (if security is an issue)
  • Bad data that I have intercepted forreporting

FATAL Level

  • Unhandled exceptions.

Also having a lot of logging details prevents me from asking the user what they were doing when they got the error message. I can easily piece it together.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)