[erlang-questions] Debugging apps with dependencies

Richard Carlsson <>
Wed May 2 08:50:48 CEST 2012


On 2012-04-30 20:05, Josh Black wrote:
> I'm working on an app, and so far, I've been testing it by using rebar
> to generate a release, then starting a console for the release and going
> from there. The problem comes when I want to use something like dbg or
> appmon to debug errors or inspect the state of my app. When I try to do,
> e.g. appmon:start() from the console for my release, it tells me
> "undefined function appmon:start/0". I'm guessing this is because I
> didn't explicitly specify appmon in my release configuration?
>
> Alternatively, I created a start.sh shell script with contents like this:
>
> erl -pa apps/*/ebin -pa deps/*/ebin -eval
> 'application:start(dependency1), application:start(dependency2),
> application:start(myapp).'
>
> This lets me start appmon and whatever else I want when I run into
> errors, but feels pretty messy and wrong.
>
> I feel like I'm missing something really obvious here. What's the
> correct way to do this?

It's usually best to not run the debugging tools directly on the node 
you're inspecting. You shouldn't have to load the code for such tools on 
the production node. Instead, start another node having all libraries 
available, and connect to the one you want to debug. Appmon and many 
other debugging tools are able to inspect the state of another node than 
the one actually running the GUI.

    /Richard



More information about the erlang-questions mailing list