Skip to content

Logging Best practices

mrutid edited this page May 30, 2012 · 2 revisions

General approach to sys logging

  • Use a wrapper over logging library

  • Use cyclic files or UDP://syslog

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

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

  • Use as many IDS as available in a current execution scope (third element)

  • Use just one line (as far as possible)

  • Use [idParam = JSON] to represent data.

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

INFO:

  • Incoming request + data

  • Request end + summary result

ERROR / WARN:

  • Weird states, possible bugs

  • Exceptions||if(err)

  • Exceptions scope (all related objects)

  • Service accessibility (DB connection 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