/** * At present the logging for bundles positioned below org.eclipse.core.runtime in the bundle * dependency stack is really sub-optimal. * * <p>In particular, logging with RuntimeLog on shutdown doesn't work as Platform shuts down * (removing listeners from RuntimeLog) before this bundle shuts down. * * <p>As such, until there is improved logging, the errors that occur on shutdown should use this * method. However, errors occuring during normal operations should use RuntimeLog as otherwise * the Error View is not getting updated. */ public void frameworkLogError(String msg, int severity, Throwable e) { if ((logTracker == null) && (bundleContext != null)) { logTracker = new ServiceTracker(bundleContext, FrameworkLog.class.getName(), null); logTracker.open(); } FrameworkLog log = (logTracker == null) ? null : (FrameworkLog) logTracker.getService(); if (log != null) log.log(new FrameworkLogEntry(PI_AUTH, severity, 0, msg, 0, e, null)); else { if (msg != null) System.err.println(msg); if (e != null) e.printStackTrace(System.err); } }
/* * @see java.util.logging.Handler#publish(java.util.logging.LogRecord) */ @Override public synchronized void publish(final @Nullable LogRecord record) { if ((record == null) || !isLoggable(record)) { return; } final String message; try { message = formatter_.format(record); } catch (final Exception e) { reportError(null, e, ErrorManager.FORMAT_FAILURE); return; } final FrameworkLogEntry logEntry = new FrameworkLogEntry( record.getLoggerName(), getSeverity(record), 0, message, 0, record.getThrown(), null); frameworkLog_.log(logEntry); }