Use :sys methods to get more information about your servers. You can use:

  • :sys.trace
  • :sys.get_status
  • :sys.statistics

Optionally, you can turn on debug mode by specifying the debug parameter in a GenServer start_link call:

iex> {:ok, pid} = GenServer.start_link(MyModule.Server, %{}, [debug: [:statistics, :trace]])

You can also enable tracing on an existing server using:

iex> :sys.trace pid, true

With debug turned on, you get a trace of messages:

iex> GenServer.call(pid, :my_command)
*DBG* <0.77.0> got call :my_command from<0.55.0>
*DBG* <0.77.0> sent %{} to <0.55.0>, new state %{}

You can also use :observer.start to get access to a wealth of additional information, including all system messages.