Skip to content

Logging Best practices

mrutid edited this page May 30, 2012 · 2 revisions

General approach to sys logging

  • Use cyclic files or syslog

  • Use always the most vervose timestamps (first element in line)

  • Use prefix related to filename/module (second element)

  • Use just one line (as far as possible)

  • Use just three levels: INFO/USER, WARN/ERROR, DEBUG

INFO:

  • Incoming request

  • Request end

ERROR / WARN:

  • Weird states, possible bugs

  • Exceptions

  • Exceptions scope (all related objects)

  • Service accessibility (DB conn error…​)

DEBUG:

  • In/Out for every public method

  • Params for every public method

  • Return/Callback + data for every public method

  • Performance metrics (TPS)

  • Sys monitoring (TOP / REDIS): may be periodic

Clone this wiki locally