1. 7
  1.  

  2. 5

    One thing I rarely see called out in these logging posts: log messages should either contain file name and line number or they should be something unique enough to be greppable. It should never take more than a few seconds to go from a log line to the place it was logged from, because there’s no telling how well the on-call reading this logs knows your service and being able to look at the log right next to the code is immensely useful.

    1. 3

      In particular, there is a special Hell for anyone who makes two different lines of code both log exactly the same error message with different root causes no way to distinguish which occurred.

      This special Hell is called having to debug something which you made ambiguous on purpose.