i:im()
is a stepwise debugger (like gdb
, lldb
, or pdb
which allow for setting breakpoints, running a program, pausing execution, etc) based on wxWidgets graphical user interface library. MongooseIM is a server - it does not bundle wxWidgets, because it does not have a graphical interface at all.
Due to the nature of the Erlang VM, where a lot of concurrent activities happen side by side, a stepwise debugger is not the best tool for the job. For example, setting a breakpoint in a process which is called via gen_server:call()
would make the call time out, leading to a cascade of errors possibly irrelevant to the problem being debugged.
However, the Erlang VM has a builtin debugging facility more suitable to its concurrent nature - a tracing debugger. Tracing does not allow for breakpoints or pausing execution. Instead, it records (a subset of all) the exact events
happening in the system and prints/saves them for a posteriori inspection.
This video and transcript provide a brief introduction to tracing on the Erlang VM (in Elixir syntax), while Mats Cronqvist, one of the Erlang veterans, elaborates on the subject in his Erlang User Conference 2014 talk Taking the printf out of printf debugging.
That being said, MongooseIM ships with two interfaces to the tracing mechanism:
dbg - the standard OTP interface - this SO post shows its basics - be careful if tracing in production, since dbg does not provide any safety mechanisms, so it's possible to overload a production system,
recon - a way more user friendly and safe for production tracing library, with outstanding documentation. This is probably your best choice when the ease of applicability and the set of features are considered.
debugger
application torebar.config
, but please see my answer below for the suggested alternative. – erszcz