Package ch.qos.logback.classic.spi

Examples of ch.qos.logback.classic.spi.ThrowableProxy


        }

        @Override
        protected void append(ILoggingEvent event) {
            try {
                ThrowableProxy throwableProxy = (ThrowableProxy) event.getThrowableProxy();
                Throwable throwable = throwableProxy == null ? null : throwableProxy.getThrowable();
                String message = event.getFormattedMessage();
                listener.onOutput(new LogEvent(event.getTimeStamp(), event.getLoggerName(), toLogLevel(event), message, throwable));
            } catch (Throwable t) {
                // Give up and try stdout
                t.printStackTrace(defaultStdOut);
View Full Code Here


  void writeFormattedException(final String message,
                               final Throwable throwable,
                               final Level level,
                               final Writer out) throws IOException {
    this.writeFormattedException(message,
        new ThrowableProxy(throwable), level, out);
  }
View Full Code Here

   * Renders a stacktrace.
   * @param t a throwable
   * @return a string rendering of the stack trace
   */
  protected static String getStackTrace(final Throwable t) {
    return GecLogbackAppender.getStackTrace(new ThrowableProxy(t));
  }
View Full Code Here

  }
 
  public String convert(LoggingEvent event) {
    StringBuilder buf = new StringBuilder(32);

    ThrowableProxy information = event.getThrowableProxy();

    if (information == null) {
      return CoreConstants.EMPTY_STRING;
    }

    ThrowableDataPoint[] tdpArray = information.getThrowableDataPointArray();

    int length = (lengthOption > tdpArray.length) ? tdpArray.length
        : lengthOption;

    // an evaluator match will cause stack printing to be skipped
View Full Code Here

              serializer.formatErrorV1(cause));
      }
      return;
    }

    ThrowableProxy tp = new ThrowableProxy(cause);
    tp.calculatePackagingData();
    final String pretty_exc = ThrowableProxyUtil.asString(tp);
    tp = null;
    if (hasQueryStringParam("json")) {
      // 32 = 10 + some extra space as exceptions always have \t's to escape.
      final StringBuilder buf = new StringBuilder(32 + pretty_exc.length());
View Full Code Here

          exception.getDetails().length());
      HttpQuery.escapeJson(exception.getDetails(), details);
      output.append(",\"details\":\"").append(details.toString()).append("\"");
    }
    if (query.showStackTrace()) {
      ThrowableProxy tp = new ThrowableProxy(exception);
      tp.calculatePackagingData();
      final String pretty_exc = ThrowableProxyUtil.asString(tp);
      final StringBuilder trace = new StringBuilder(pretty_exc.length());
      HttpQuery.escapeJson(pretty_exc, trace);
      output.append(",\"trace\":\"").append(trace.toString()).append("\"");
    }
View Full Code Here

    output.append(500);
    final StringBuilder msg = new StringBuilder(message.length());
    HttpQuery.escapeJson(message, msg);
    output.append(",\"message\":\"").append(msg.toString()).append("\"");
    if (query.showStackTrace()) {
      ThrowableProxy tp = new ThrowableProxy(exception);
      tp.calculatePackagingData();
      final String pretty_exc = ThrowableProxyUtil.asString(tp);
      final StringBuilder trace = new StringBuilder(pretty_exc.length());
      HttpQuery.escapeJson(pretty_exc, trace);
      output.append(",\"trace\":\"").append(trace.toString()).append("\"");
    }
View Full Code Here

    String loggerName = getRandomLoggerNameFromPool(loggerNamePool);
    Level randomLevel = getRandomLevel();
    Throwable t = getRandomThrowable(randomLevel);
    ThrowableProxyVO throwableProxy = null;
    if (t != null) {
      throwableProxy = ThrowableProxyVO.build(new ThrowableProxy(t));
      pupulateWithPackagingData(throwableProxy.getStackTraceElementProxyArray());
    }
    return new LogStatement(loggerName, randomLevel, mat,
        throwableProxy);
  }
View Full Code Here

    nesting();
  }
 
  private void nesting() {
    throwable = new Throwable("x");
    throwableProxy = new ThrowableProxy(throwable);
    PackagingDataCalculator pdc = new PackagingDataCalculator();
    pdc.calculate(throwableProxy);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void layoutWithException() throws Exception {
    layout.setPattern("%level %thread %msg %ex");
    LoggingEvent le = createLoggingEvent();
    le.setThrowableProxy(new ThrowableProxy(new Exception("test Exception")));
    String result = layout.doLayout(le);

    String stringToParse = layout.getFileHeader();
    stringToParse = stringToParse + layout.getPresentationHeader();
    stringToParse += result;
View Full Code Here

TOP

Related Classes of ch.qos.logback.classic.spi.ThrowableProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.