Reputation: 3721
The Eclipse IStatus interface has message statuses different from ones usually used in Java. Furthermore the Status class constructor allows for plugin specific code to be provided, but there is no description how it should be used.
What is the recommended way to print debug and trace messages from Eclipse plugin?
Edit: I am specifically interested in logging Trace and Debug messages, since IStatus allows only for OK, INFO, WARNING, ERROR and CANCEL. It is also not clear when OK and CANCEL should be used.
Upvotes: 0
Views: 285
Reputation: 111216
The ILog
interface logs IStatus
objects in the main Eclipse log (the .log file in the workspace .metadata directory).
If your plugin has an Activator derived from Plugin
(or AbstractUIPlugin
) you can get the ILog
interface for your plugin using the getLog()
method of Plugin
.
You can also use
Bundle bundle = Platform.getBundle("plugin id");
ILog log = Platform.getLog(bundle);
IStatus
is used in several contexts. The OK
and CANCEL
status codes are used when IStatus
is used to indicate the result of an operation, they are not really used for logging.
Note: The ILog
interface always logs everything it is given, there is no way to enable or disable different levels of logging.
Upvotes: 2