[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] [prov] Debug/tracing support

I have added basic infrastructure in org.eclipse.equinox.p2.core for using DebugOptions. If you find yourself needing to add extra "println" statements for debugging purposes, consider whether that extra debugging info might come in handy when p2 is in the field. To add more tracing, just add an extra DEBUG_* field to the Tracing class, and add the option key to the .options file, turned off by default, with a brief description of what the tracing does. All debug statements should be controlled with their own specific flag rather than just Tracing.DEBUG, to allow fine-tuning of the trace output. We should have no "System.out.println" or "Throwable.printStackTrace()" statements in our code that aren't controlled by a debug option. For exceptions, it's usually better to log than to use a trace option.

While I'm at it, a quick reminder to those who are tempted to add more code like this:

} catch (IOException e) {
        // TODO Auto-generated catch block

It's *really* easy to just log it instead using our handy LogHelper class:

} catch (IOException e) {
        LogHelper.log(new Status(IStatus.ERROR, <YourBundleId>, "Exception reading <blort>", e)); //$NON-NLS-1$

Messages headed for the log don't need to translated, so no need to fuss with NLS, etc.