5

I'm trying to start an Erlang app that is failing. All I see in the shell is:

=INFO REPORT==== 7-Jan-2010::17:37:42 ===
    application: ui
    exited: {shutdown,{ui_app,start,[normal,[]]}}
    type: temporary

How can I get Erlang to give me more information as to why the application is not starting? There currently is no other output in the shell.

Jeremy Raymond
  • 5,817
  • 3
  • 31
  • 33

3 Answers3

13

You could try launching the shell with more logging support:

erl -boot start_sasl

this might get give a bit more details.

jldupont
  • 93,734
  • 56
  • 203
  • 318
2

There is a patch (tp/supervisor-pass-on-errors) that was included in release R16B. This patch makes exit reasons appear in application stop log messages, which thus become much more useful than the {shutdown,{ui_app,start,[normal,[]]}}-style messages we've had until now.

This is the entry in the README:

OTP-10490  == stdlib ==

    If a child process fails in its start function, then the
    error reason was earlier only reported as an error report
    from the error_handler, and supervisor:start_link would only
    return {error,shutdown}. This has been changed so the
    supervisor will now return {error,{shutdown,Reason}}, where
    Reason identifies the failing child and its error reason.
    (Thanks to Tomas Pihl)
legoscia
  • 39,593
  • 22
  • 116
  • 167
0

It is a pain, but the way I do it is the old fashioned way, by writing io:format's into the start function of the application (ie the code of the module with the behaviour of application) and working out which line fails :(

Sometimes brute force and ignorance is your only man...

Gordon Guthrie
  • 6,252
  • 2
  • 27
  • 52
  • Yea - I _hate_ sticking io:formats in the code just to find out where a crash is... which the Erlang stack traces would give exact line numbers for these type of things as stack traces do in other languages. – Jeremy Raymond Jan 08 '10 at 22:16
  • Instead of using io:format, it's better to use eunit debug macros, such as ?debugHere(), ?debugVal(Val), ?debugMsg(Msg) or ?debugFmt(String, [Arg1, Arg2, ...]). – pedromanoel Dec 21 '11 at 19:49
  • Well since this comment was written by me - the new release (R15B) of Erlang now has the line numbers in the stacktrace. – Gordon Guthrie Jan 01 '12 at 10:44