Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #5102 - Show stacktrace of startup exception #5103

Closed
wants to merge 1 commit into from

Conversation

timorantalaiho
Copy link
Contributor

#5102

This makes it a lot easier to debug a problem
like

{2.0.0-SNAPSHOT}: Startup Failed ...

  • NumberFormatException[For input string: ""]

because now you see from where the error comes
from (which might be from a plugin!).

@javanna javanna self-assigned this Feb 13, 2014
@javanna
Copy link
Member

javanna commented Feb 14, 2014

Thinking more about this, the point of the buildErrorMessage method was exactly to hide stacktraces and print a nicer, yet meaningful, error message and avoid printing out big stacktraces which might scare the hell out of users, especially if not familiar with java... :)

I do see your point, but if the error comes from a plugin, then I'd expect the plugin to log the stacktrace if needed. Thoughts?

@timorantalaiho
Copy link
Contributor Author

I must say I disagree on all counts :) Because I cannot imagine non-technical people trying to solve errors that can be seen on ES startup output. If you look at a non-trivial server program starting, you should be prepared to see technical stuff. Logging is not a foolproof option, because you cannot always count on logging to work on startup (and as you can see in [the diff|https://github.com//pull/5103/files], even the original code does not rely on logger when running with es.foreground=true).

And finally, there is the same problem with the own configuration of ES, not just plugins. Try configuring a space (" ") for both transport http and tcp ports, and all you get is

[2014-02-17 09:15:55,407][INFO ][node                     ] [L396] initialized
[2014-02-17 09:15:55,407][INFO ][node                     ] [L396] starting ...
{0.90.11}: Startup Failed ...
- NumberFormatException[For input string: ""]

Years and years of programmer time have been lost by swallowing stack traces in JVM programs. I contributed a couple of hours to that pile last week ;)

@javanna
Copy link
Member

javanna commented Feb 17, 2014

I see your point @timorantalaiho and do appreciate your feedback!
Just to be clear, I'm not against your PR, just a bit on the fence as I see what the intention of the orginal code was.
Anybody else have an opinion about this?

@imotov
Copy link
Contributor

imotov commented Feb 19, 2014

I agree that sometimes stack trace is indeed helpful. Maybe we can add a setting and depending on this settings the buildErrorMessage() method will produce either just an error message or an error message with a stack trace.

This makes it a lot easier to debug a problem
like

{2.0.0-SNAPSHOT}: Startup Failed ...
- NumberFormatException[For input string: ""]

because now you see from where the error comes
from (which might be from a plugin!).
@timorantalaiho
Copy link
Contributor Author

Thanks for comments! @imotov , I implemented the toggling you suggest (with system property) in #5187 . A new pull request, because I would prefer this current one which I think is simpler. But either way is fine, and sure this can be refined still.

@javanna
Copy link
Member

javanna commented Apr 4, 2014

Closing in favor of #5187

@javanna javanna closed this Apr 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants