Monday, 1 October 2007

Eclipse RCP - Where are my errors?

By default, Eclipse swallows up most error messages and exceptions generated by the platform. During development though, it is advisable to enable the console log so the errors messages and exceptions can be seen. To enable the console log, “-consoleLog” should be added to the program arguments of the run configuration:



For each configuration, the program arguments can be changed via the "Arguments" tab on the Run dialog, accessible via the “Run…” menu or the run icon. You should add this for each run configuration.

That's it! The bad news is that now you'll see the nasty errors and exceptions that your application is generating. The good news is that that you're aware of them, you'll be able to track them down, fix them, and improve the quality of your product...

2 comments:

ale said...

thanks! i always opened .log everytime i had to track down an exception.

i have a question, i wanted to code an exception thrower that would look at the log and if an exception is trhown show my user a window with the stack trace. do you know if this is possible?

Benjamin Nortier said...

You should be able to use your own console logger and display a dialog when an exception is logged by parsing the console text. This will only give you the stack tract if it's part of the console output.

Alternatively you could hook into the RCP exception mechanism directly, but I'm not sure how difficult this would be...