knutin / elli

Simple, robust and performant Erlang web server
MIT License
663 stars 79 forks source link

Error reporting, in console #52

Closed andrewcantos closed 11 years ago

andrewcantos commented 11 years ago

I am not getting any exception/error reporting in my console when using the following startup command line...

$ rebar compile && erl -pa deps/*/ebin ebin

I have also tried including application:start(sasl) and -s start_sasl but not getting stack traces and exception information.

Sorry if this is an obvious issue, but I have searched far and wide and also googled a fair bit. Thanks in advance for any help with this issue.

knutin commented 11 years ago

Just to be sure as it is not entirely clear, is Elli running? Do you have a callback where you expect it to crash or log something?

andrewcantos commented 11 years ago

Yep, elli is running and an exception should be getting generated within the callback (or modules it relies on).

On Thursday, 3 January 2013, Knut Nesheim wrote:

Just to be sure as it is not entirely clear, is Elli running? Do you have a callback where you expect it to crash or log something?

— Reply to this email directly or view it on GitHubhttps://github.com/knutin/elli/issues/52#issuecomment-11841099.

knutin commented 11 years ago

Ok. The way it works is this:

If you are not handling the request_throw event, there will be no log from Elli.

See https://github.com/wooga/elli_access_log/blob/master/src/elli_access_log.erl#L79for an example. You could use this middleware if you want to have some decent logging for free. If you use elli_access_log, you don't need to implement anything in handle_event/3.

andrewcantos commented 11 years ago

Thank you very much for your response Knut, I will give that a try.

BTW, I really like what you guys are doing with Elli, it's a very elegant implementation and it was extremely quick to get an API up and running.

Cheers, Andrew

On Friday, 4 January 2013, Knut Nesheim wrote:

Ok. The way it works is this:

  • Elli catches any exception, error or exit raised by the user callback
  • Elli returns 500 to the client (or looks in the exception for a custom response)
  • Elli calls the user callback notifying it that there was an exception. handle_event(request_throw, [Req, Exception, Stack], _) -> ok is called in your callback

If you are not handling the request_throw event, there will be no log from Elli.

See

https://github.com/wooga/elli_access_log/blob/master/src/elli_access_log.erl#L79for an example. You could use this middleware if you want to have some decent logging for free. If you use elli_access_log, you don't need to implement anything in handle_event/3.

— Reply to this email directly or view it on GitHubhttps://github.com/knutin/elli/issues/52#issuecomment-11845030.

knutin commented 11 years ago

Thanks for the feedback :)

I will leave the issue open. If it works, will you please close it?

Knut

andrewcantos commented 11 years ago

No worries Knut, will do. This will be tomorrow though, middle of the night here in Aus :)

On Fri, Jan 4, 2013 at 2:00 AM, Knut Nesheim notifications@github.comwrote:

Thanks for the feedback :)

I will leave the issue open. If it works, will you please close it?

Knut

— Reply to this email directly or view it on GitHubhttps://github.com/knutin/elli/issues/52#issuecomment-11846317.

andrewcantos commented 11 years ago

Thanks, this works fine.

Cheers, Andrew