/** * Logs performance event failures to the platform's performance log */ private void logFailure(PerformanceStats stats, String pluginId, long elapsed) { //may have failed to get the performance log service if (log == null) return; if (pluginId == null) pluginId = Platform.PI_RUNTIME; String msg = "Performance failure: " + stats.getEvent() + " blame: " + stats.getBlameString() + " context: " + stats.getContext() + " duration: " + elapsed; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Status status = new Status(IStatus.WARNING, pluginId, 1, msg, new RuntimeException()); log.log(new FrameworkLogEntry(status, status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), 0, status.getException(), null)); }
private static IStatus convertToStatus(FrameworkLogEntry entry) { FrameworkLogEntry[] children = entry.getChildren(); if (children != null) { IStatus[] statusChildren = new Status[children.length]; for (int i = 0; i < statusChildren.length; i++) statusChildren[i] = convertToStatus(children[i]); return new MultiStatus(entry.getEntry(), entry.getBundleCode(), statusChildren, entry.getMessage(), entry.getThrowable()); } return new Status(entry.getSeverity(), entry.getEntry(), entry.getBundleCode(), entry.getMessage(), entry.getThrowable()); }
public void log(FrameworkLogEntry logEntry) { System.err.print(logEntry.getEntry() + " "); //$NON-NLS-1$ System.err.println(logEntry.getMessage()); if (logEntry.getThrowable() != null) logEntry.getThrowable().printStackTrace(System.err); }
@Override public void log(FrameworkLogEntry logEntry) { switch (logEntry.getSeverity()) { case FrameworkLogEntry.OK: logger.debug(logEntry.getMessage(), logEntry.getThrowable()); break; case FrameworkLogEntry.INFO: logger.info(logEntry.getMessage(), logEntry.getThrowable()); break; case FrameworkLogEntry.CANCEL: case FrameworkLogEntry.WARNING: logger.warn(logEntry.getMessage(), logEntry.getThrowable()); break; case FrameworkLogEntry.ERROR: logger.error(logEntry.getMessage(), logEntry.getThrowable()); } }
/** * Writes the ENTRY or SUBENTRY header for an entry. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. * @param depth the depth of th entry * @param entry the entry to write the header for * @throws IOException if any error occurs writing to the log */ private void writeEntry(int depth, FrameworkLogEntry entry) throws IOException { if (depth == 0) { writeln(); // write a blank line before all !ENTRY tags bug #64406 write(ENTRY); } else { write(SUBENTRY); writeSpace(); write(Integer.toString(depth)); } writeSpace(); write(entry.getEntry()); writeSpace(); write(Integer.toString(entry.getSeverity())); writeSpace(); write(Integer.toString(entry.getBundleCode())); writeSpace(); write(getDate(new Date())); writeln(); }
public void log(FrameworkLogEntry logEntry) { logger.log(logEntry, convertLevel(logEntry), logEntry.getMessage(), logEntry.getThrowable()); }
/** * Writes the STACK header to the log for the given entry. * @param entry the entry to write the stacktrace for * @throws IOException if any error occurs writing to the log */ private void writeStack(FrameworkLogEntry entry) throws IOException { Throwable t = entry.getThrowable(); if (t != null) { String stack = getStackTrace(t); write(STACK); writeSpace(); write(Integer.toString(entry.getStackCode())); writeln(); write(stack); } }
static int convertLevel(FrameworkLogEntry logEntry) { switch (logEntry.getSeverity()) { case FrameworkLogEntry.ERROR : return LogService.LOG_ERROR; case FrameworkLogEntry.WARNING : return LogService.LOG_WARNING; case FrameworkLogEntry.INFO : return LogService.LOG_INFO; case FrameworkLogEntry.OK : return LogService.LOG_DEBUG; case FrameworkLogEntry.CANCEL : default : return 32; // unknown } } }
/** * Writes the MESSAGE header to the log for the given entry. * @param entry the entry to write the message for * @throws IOException if any error occurs writing to the log */ private void writeMessage(FrameworkLogEntry entry) throws IOException { write(MESSAGE); writeSpace(); writeln(entry.getMessage()); }
/** * Writes the log entry to the log using the specified depth. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. * @param depth the depth of th entry * @param entry the entry to log * @throws IOException if any error occurs writing to the log */ private void writeLog(int depth, FrameworkLogEntry entry) throws IOException { writeEntry(depth, entry); writeMessage(entry); writeStack(entry); FrameworkLogEntry[] children = entry.getChildren(); if (children != null) { for (int i = 0; i < children.length; i++) { writeLog(depth + 1, children[i]); } } }
/** * Writes the ENTRY or SUBENTRY header for an entry. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. * @param depth the depth of th entry * @param entry the entry to write the header for * @throws IOException if any error occurs writing to the log */ private void writeEntry(int depth, FrameworkLogEntry entry) throws IOException { if (depth == 0) { writeln(); // write a blank line before all !ENTRY tags bug #64406 write(ENTRY); } else { write(SUBENTRY); writeSpace(); write(Integer.toString(depth)); } writeSpace(); write(entry.getEntry()); writeSpace(); write(Integer.toString(entry.getSeverity())); writeSpace(); write(Integer.toString(entry.getBundleCode())); writeSpace(); write(getDate(new Date())); writeln(); }
public void log(FrameworkLogEntry logEntry) { logger.log(logEntry, convertLevel(logEntry), logEntry.getMessage(), logEntry.getThrowable()); }
/** * Writes the STACK header to the log for the given entry. * @param entry the entry to write the stacktrace for * @throws IOException if any error occurs writing to the log */ private void writeStack(FrameworkLogEntry entry) throws IOException { Throwable t = entry.getThrowable(); if (t != null) { String stack = getStackTrace(t); write(STACK); writeSpace(); write(Integer.toString(entry.getStackCode())); writeln(); write(stack); } }
public void log(FrameworkLogEntry logEntry) { System.err.print(logEntry.getEntry() + " "); //$NON-NLS-1$ System.err.println(logEntry.getMessage()); if (logEntry.getThrowable() != null) logEntry.getThrowable().printStackTrace(System.err); }
static int convertLevel(FrameworkLogEntry logEntry) { switch (logEntry.getSeverity()) { case FrameworkLogEntry.ERROR : return LogService.LOG_ERROR; case FrameworkLogEntry.WARNING : return LogService.LOG_WARNING; case FrameworkLogEntry.INFO : return LogService.LOG_INFO; case FrameworkLogEntry.OK : return LogService.LOG_DEBUG; case FrameworkLogEntry.CANCEL : default : return 32; // unknown } } }
/** * Writes the MESSAGE header to the log for the given entry. * @param entry the entry to write the message for * @throws IOException if any error occurs writing to the log */ private void writeMessage(FrameworkLogEntry entry) throws IOException { write(MESSAGE); writeSpace(); writeln(entry.getMessage()); }
/** * Writes the log entry to the log using the specified depth. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. * @param depth the depth of th entry * @param entry the entry to log * @throws IOException if any error occurs writing to the log */ private void writeLog(int depth, FrameworkLogEntry entry) throws IOException { writeEntry(depth, entry); writeMessage(entry); writeStack(entry); FrameworkLogEntry[] children = entry.getChildren(); if (children != null) { for (int i = 0; i < children.length; i++) { writeLog(depth + 1, children[i]); } } }
private void internalError(String elementName) { FrameworkLogEntry error; String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_PARSE_UNKNOWNTOP_ELEMENT, elementName); error = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, (manifestInfo.pluginId == null ? message : "Plug-in : " + manifestInfo.pluginId + ", " + message), 0, null, null); //$NON-NLS-1$ //$NON-NLS-2$ // adaptor.getFrameworkLog().log(error); }
private static IStatus convertToStatus(FrameworkLogEntry entry) { FrameworkLogEntry[] children = entry.getChildren(); if (children != null) { IStatus[] statusChildren = new Status[children.length]; for (int i = 0; i < statusChildren.length; i++) statusChildren[i] = convertToStatus(children[i]); return new MultiStatus(entry.getEntry(), entry.getBundleCode(), statusChildren, entry.getMessage(), entry.getThrowable()); } return new Status(entry.getSeverity(), entry.getEntry(), entry.getBundleCode(), entry.getMessage(), entry.getThrowable()); }
/** * Writes the ENTRY or SUBENTRY header for an entry. A depth value of 0 * indicates that the log entry is the root entry. Any value greater than 0 indicates * a sub-entry. * @param depth the depth of th entry * @param entry the entry to write the header for * @throws IOException if any error occurs writing to the log */ private void writeEntry(int depth, FrameworkLogEntry entry) throws IOException { if (depth == 0) { writeln(); // write a blank line before all !ENTRY tags bug #64406 write(ENTRY); } else { write(SUBENTRY); writeSpace(); write(Integer.toString(depth)); } writeSpace(); write(entry.getEntry()); writeSpace(); write(Integer.toString(entry.getSeverity())); writeSpace(); write(Integer.toString(entry.getBundleCode())); writeSpace(); write(getDate(new Date())); writeln(); }