Search code examples
debuggingerlangtrace

How to use trace and dbg in Erlang to debug and trace my program?


I am trying to start using erlang:trace/3 and the dbg module to trace the behaviour of a live production system without taking the server down.

The documentation is opaque (to put it mildly) and there don't appear to be any useful tutorials online.

What I spent all day trying to do was capture what was happening in a particular function by trying to apply a trace to Module:Function using dbg:c and dbg:p but with no success at all.

Does anyone have a succinct explanation of how to use trace in a live Erlang system?


Solution

  • If you would prefer a graphical tracer then try erlyberly. It allows you to select the functions you would like to trace (on all processes at the moment) and deals with the dbg API.

    However it does not protect against overload so is not suitable for production systems.

    enter image description here