use of ch.qos.logback.classic.spi.IThrowableProxy in project sonarqube by SonarSource.
the class LogbackJsonLayout method render.
private static void render(JsonWriter output, IThrowableProxy tp, int nbOfTabs) throws IOException {
String tabs = StringUtils.repeat("\t", nbOfTabs);
int commonFrames = tp.getCommonFrames();
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
for (int i = 0; i < stepArray.length - commonFrames; i++) {
StackTraceElementProxy step = stepArray[i];
output.value(tabs + step.toString());
}
if (commonFrames > 0) {
output.value(tabs + "... " + commonFrames + " common frames omitted");
}
for (IThrowableProxy suppressed : tp.getSuppressed()) {
output.value(format("%sSuppressed: %s: %s", tabs, suppressed.getClassName(), suppressed.getMessage()));
render(output, suppressed, nbOfTabs + 1);
}
}
use of ch.qos.logback.classic.spi.IThrowableProxy in project pravega by pravega.
the class MetricsLogAppender method recordEvent.
private void recordEvent(String metricName, ILoggingEvent event) {
IThrowableProxy p = event.getThrowableProxy();
while (shouldUnwrap(p)) {
p = p.getCause();
}
DYNAMIC_LOGGER.recordMeterEvents(metricName, 1, MetricsTags.exceptionTag(event.getLoggerName(), p == null ? null : p.getClassName()));
}
use of ch.qos.logback.classic.spi.IThrowableProxy in project TOSCAna by StuPro-TOSCAna.
the class MemoryAppender method appendThrowable.
private void appendThrowable(IThrowableProxy proxy, ILoggingEvent loggingEvent) {
// Append Exception Message
appendToLog(loggingEvent, String.format("%s: %s", proxy.getClassName(), proxy.getMessage()));
// Append Exception Stack Trace
for (StackTraceElementProxy element : loggingEvent.getThrowableProxy().getStackTraceElementProxyArray()) {
appendToLog(loggingEvent, "\t" + element.getSTEAsString());
}
if (proxy.getSuppressed().length > 0) {
appendToLog(loggingEvent, "Suppressed Exceptions:");
for (IThrowableProxy p : proxy.getSuppressed()) {
appendThrowable(p, loggingEvent);
}
}
if (proxy.getCause() != null) {
appendToLog(loggingEvent, "Cause:");
appendThrowable(proxy.getCause(), loggingEvent);
}
}
use of ch.qos.logback.classic.spi.IThrowableProxy in project qpid-broker-j by apache.
the class Logback1027WorkaroundTurboFilterTest method assertLoggingEvent.
private void assertLoggingEvent(final ILoggingEvent loggingEvent) {
assertEquals(Level.INFO, loggingEvent.getLevel());
assertEquals(TEST_LOG_MESSAGE, loggingEvent.getMessage());
assertNull(loggingEvent.getArgumentArray());
IThrowableProxy thing = loggingEvent.getThrowableProxy();
assertEquals(Logback1027WorkaroundTurboFilter.StringifiedException.class.getName(), thing.getClassName());
}
use of ch.qos.logback.classic.spi.IThrowableProxy in project sonarlint-core by SonarSource.
the class LogCallbackAppenderTest method testExceptionHandling.
@Test
public void testExceptionHandling() {
appender.setErrorHandler(errorHandler);
reset(listener);
event = mock(ILoggingEvent.class);
IThrowableProxy throwable = new ThrowableProxy(new IOException());
when(event.getThrowableProxy()).thenReturn(throwable);
when(event.getLevel()).thenReturn(Level.ERROR);
appender.append(event);
verify(errorHandler).handleException("java.io.IOException");
}
Aggregations