Proper Registration for Eclipse Plugin Development

When I catch the exception that I selected, what is the correct registration of this exception? I know that the user can see the "error log" in eclipse.

Here are a few different ways I can register ... I’m not sure if this is the best and what exactly the user will see when I write it this way.

  • Just print the stack trace. Will this be displayed in the Error Log window?
  • Activator.getDefault().log(e.getMessage(), e); In each catch clause, I can register information with an activator associated with the plug-in identifier.

Is there a way to write an error in eclipse?

+4
source share
1 answer

The print of the stack trace will not be displayed in the error log, it will simply be lost (except when executed from Eclipse or using the console).

Logging Activatoris the usual way to register. Code logging provided by classes Pluginor AbstractUIPluginis:

ILog log = Activator.getDefault().getLog();

log.log(new Status(....));

Statushas several different constructors, depending on what you want to write. For instance:

new Status(IStatus.ERROR, ID, errorNumber, message, exception);

new Status(IStatus.ERROR, message, exception);
+7
source

All Articles