values[i++] = iThrowableProxy; if (iThrowableProxy instanceof ThrowableProxy) { values[i++] = ((ThrowableProxy) iThrowableProxy).getThrowable(); } else { values[i++] = null;
values[i++] = iThrowableProxy; if (iThrowableProxy instanceof ThrowableProxy) { values[i++] = ((ThrowableProxy) iThrowableProxy).getThrowable(); } else { values[i++] = null;
@Override public Throwable getThrowable() { Throwable result = null; IThrowableProxy throwableProxy = loggingEvent.getThrowableProxy(); if (null != throwableProxy) { if (throwableProxy instanceof ThrowableProxy) { result = ((ThrowableProxy) throwableProxy).getThrowable(); } } return result; }
@Override public Throwable getThrowable() { Throwable result = null; IThrowableProxy throwableProxy = loggingEvent.getThrowableProxy(); if (null != throwableProxy) { if (throwableProxy instanceof ThrowableProxy) { result = ((ThrowableProxy) throwableProxy).getThrowable(); } } return result; }
@Override public Throwable getThrowable() { Throwable result = null; IThrowableProxy throwableProxy = loggingEvent.getThrowableProxy(); if (null != throwableProxy) { if (throwableProxy instanceof ThrowableProxy) { result = ((ThrowableProxy) throwableProxy).getThrowable(); } } return result; }
/** * Gets the throwable from the log event (if any) * @param event The log event * @return The throwable (or null) */ private Throwable extractThrowable(ILoggingEvent event) { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy instanceof ThrowableProxy) { return ((ThrowableProxy) throwableProxy).getThrowable(); } return null; }
/** * Gets the throwable from the log event (if any) * @param event The log event * @return The throwable (or null) */ private Throwable extractThrowable(ILoggingEvent event) { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy instanceof ThrowableProxy) { return ((ThrowableProxy) throwableProxy).getThrowable(); } return null; }
/** * @see com.stackify.api.common.log.EventAdapter#getThrowable(java.lang.Object) */ @Override public Throwable getThrowable(final ILoggingEvent event) { IThrowableProxy iThrowableProxy = event.getThrowableProxy(); if (iThrowableProxy != null) { if (iThrowableProxy instanceof ThrowableProxy) { ThrowableProxy throwableProxy = (ThrowableProxy) iThrowableProxy; return throwableProxy.getThrowable(); } } return null; }
@Override public String convert(ILoggingEvent event) { StringBuilder appendTo = new StringBuilder(); IThrowableProxy tProxy = event.getThrowableProxy(); if (tProxy != null && ThrowableProxy.class.isAssignableFrom(tProxy.getClass())) { StacktraceConverter.CONVERTER.convert(((ThrowableProxy) tProxy).getThrowable(), appendTo); return appendTo.toString(); } return null; } }
private String determineClassName(IThrowableProxy throwable) { if (!useSimpleClassName) { return throwable.getClassName(); } if (throwable instanceof ThrowableProxy) { return ((ThrowableProxy) throwable).getThrowable().getClass().getSimpleName(); } String className = throwable.getClassName(); return className.substring(className.lastIndexOf('.') + 1); }
@Override public Exception getException() { Exception exception = null; if (isException()) { Throwable throwable = ((ThrowableProxy)this.loggingEvent.getThrowableProxy()).getThrowable(); exception = throwable instanceof Exception ? (Exception) throwable : new Exception(throwable); } return exception; }
@Override public Exception getException() { Exception exception = null; if (isException()) { Throwable throwable = ((ThrowableProxy)this.loggingEvent.getThrowableProxy()).getThrowable(); exception = throwable instanceof Exception ? (Exception) throwable : new Exception(throwable); } return exception; }
@Override public String toString() { final StringBuilder sb = new StringBuilder(); final Collection<ILoggingEvent> loggingEvents = new ArrayList<>(_temporaryAppender.list); for (final ILoggingEvent loggingEvent : loggingEvents) { sb.append(loggingEvent).append("\n"); final IThrowableProxy throwableProxy = loggingEvent.getThrowableProxy(); if (ThrowableProxy.class.isInstance(throwableProxy)) { // ... dump common exception format when its a ThrowableProxy class instance final OutputStream outputStream = new OutputStream() { @Override public void write(int b) throws IOException { sb.append((char) b); } }; try (final PrintStream s = new PrintStream(outputStream)) { //noinspection ThrowableResultOfMethodCallIgnored ((ThrowableProxy) throwableProxy).getThrowable().printStackTrace(s); } } else if (throwableProxy != null) { // ... well unfortunately some additional package data are dump here making to complicated to test TTD against it. sb.append(ThrowableProxyUtil.asString(throwableProxy)); } } return sb.toString(); } }
@Override public String convert(ILoggingEvent event) { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy == null || isExcludedByEvaluator(event)) { return CoreConstants.EMPTY_STRING; } // compute stack trace hashes Deque<String> stackHashes = null; if(inlineHash && (throwableProxy instanceof ThrowableProxy)) { stackHashes = stackHasher.hexHashes(((ThrowableProxy) throwableProxy).getThrowable()); } /* * The extra 100 gives a little more buffer room since we actually * go over the maxLength before detecting it and truncating. */ StringBuilder builder = new StringBuilder(Math.min(BUFFER_INITIAL_CAPACITY, this.maxLength + 100 > 0 ? this.maxLength + 100 : this.maxLength)); if (rootCauseFirst) { appendRootCauseFirst(builder, null, ThrowableProxyUtil.REGULAR_EXCEPTION_INDENT, throwableProxy, stackHashes); } else { appendRootCauseLast(builder, null, ThrowableProxyUtil.REGULAR_EXCEPTION_INDENT, throwableProxy, stackHashes); } if (builder.length() > maxLength) { builder.setLength(maxLength - ELLIPSIS.length()); builder.append(ELLIPSIS); } return builder.toString(); }
/** * This is called only for configured levels. * It will not be executed for DEBUG level if root logger is INFO. */ @Override protected void append(ILoggingEvent event) { Span span = tracer.activeSpan(); if (span != null) { Map<String, Object> logs = new HashMap<>(6); logs.put("logger", event.getLoggerName()); logs.put("level", event.getLevel().toString()); logs.put("thread", event.getThreadName()); logs.put("message", event.getFormattedMessage()); if (Level.ERROR.equals(event.getLevel())) { logs.put("event", Tags.ERROR); } IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy instanceof ThrowableProxy) { Throwable throwable = ((ThrowableProxy)throwableProxy).getThrowable(); // String stackTrace = ThrowableProxyUtil.asString(throwableProxy); if (throwable != null) { logs.put("error.object", throwable); } } span.log(TimeUnit.MICROSECONDS.convert(event.getTimeStamp(), TimeUnit.MILLISECONDS), logs); } } }
@Override public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy != null && throwableProxy instanceof ThrowableProxy) { String hash = hasher.hexHash(((ThrowableProxy)event.getThrowableProxy()).getThrowable()); JsonWritingUtils.writeStringField(generator, getFieldName(), hash); } } }
values[i++] = iThrowableProxy; if (iThrowableProxy instanceof ThrowableProxy) { values[i++] = ((ThrowableProxy) iThrowableProxy).getThrowable(); } else { values[i++] = null;
@Override protected void append(ILoggingEvent event) { Throwable throwable = null; IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy instanceof ThrowableProxy) { throwable = ((ThrowableProxy) throwableProxy).getThrowable(); } try { LogLevel logLevel = this.utils.toLogLevel(event.getLevel()); LogEvent logevent = LogUtils.newLogEvent(event.getMarker(), logLevel, event.getMessage(), event.getArgumentArray(), throwable, event.getTimeStamp()); getObservationManager().notify(logevent, event.getLoggerName(), null); } catch (IllegalArgumentException e) { this.logger.debug("Unsupported log level [{}]", event.getLevel()); } catch (ComponentLookupException e) { this.logger.error("Can't find any implementation of [{}]", ObservationManager.class.getName(), e); } }
values[i++] = iThrowableProxy; if (iThrowableProxy instanceof ThrowableProxy) { values[i++] = ((ThrowableProxy) iThrowableProxy).getThrowable(); } else { values[i++] = null;
values[i++] = iThrowableProxy; if (iThrowableProxy instanceof ThrowableProxy) { values[i++] = ((ThrowableProxy) iThrowableProxy).getThrowable(); } else { values[i++] = null;