當前位置: 首頁>>代碼示例>>Java>>正文


Java IThrowableProxy.getMessage方法代碼示例

本文整理匯總了Java中ch.qos.logback.classic.spi.IThrowableProxy.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java IThrowableProxy.getMessage方法的具體用法?Java IThrowableProxy.getMessage怎麽用?Java IThrowableProxy.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ch.qos.logback.classic.spi.IThrowableProxy的用法示例。


在下文中一共展示了IThrowableProxy.getMessage方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: transformStackTrace

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private String transformStackTrace(ILoggingEvent event) {
    IThrowableProxy throwableProxy = event.getThrowableProxy();
    StackTraceElement stackTraceElement = throwableProxy.getStackTraceElementProxyArray()[0].getStackTraceElement();

    String time = DEFAULT_DATE_FORMAT.format(new Date(event.getTimeStamp()));
    String threadName = event.getThreadName();
    String level = event.getLevel().toString().substring(0, 1);
    String logger = event.getLoggerName();
    String exception = throwableProxy.getClassName();
    String msg = throwableProxy.getMessage();
    String className = stackTraceElement.getClassName();
    String method = stackTraceElement.getMethodName();
    int lineNumber = stackTraceElement.getLineNumber();

    return String.format(FORMAT_MESSAGE, title, time, threadName, level, logger, exception, msg, className, method, lineNumber);
}
 
開發者ID:mitaketw,項目名稱:logback-sms-appender,代碼行數:17,代碼來源:SmsAppender.java

示例2: buildCausalString

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
/**
 * Builds an exception causation string by following the exception caused-by chain.
 * @param exception The exception to process.
 * @return A string describing all exceptions in the chain.
 */
private static String buildCausalString(IThrowableProxy exception)
{
  final StringBuilder buff = new StringBuilder();

  buff.append(exception.getClassName());
  if (exception.getMessage() != null)
  {
    buff.append(": ").append(exception.getMessage());
  }

  if (exception.getCause() != null)
  {
    buff.append("; caused by: ").append(buildCausalString(exception.getCause()));
  }

  return buff.toString();
}
 
開發者ID:gkopff,項目名稱:logback-raygun,代碼行數:23,代碼來源:RaygunAppender.java

示例3: toProto

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private static Proto.Throwable toProto(IThrowableProxy t) {
    Proto.Throwable.Builder builder = Proto.Throwable.newBuilder()
            .setClassName(t.getClassName());
    String message = t.getMessage();
    if (message != null) {
        builder.setMessage(message);
    }
    for (StackTraceElementProxy element : t.getStackTraceElementProxyArray()) {
        builder.addStackTraceElement(ErrorMessage.toProto(element.getStackTraceElement()));
    }
    builder.setFramesInCommonWithEnclosing(t.getCommonFrames());
    IThrowableProxy cause = t.getCause();
    if (cause != null) {
        builder.setCause(toProto(cause));
    }
    for (IThrowableProxy suppressed : t.getSuppressed()) {
        builder.addSuppressed(toProto(suppressed));
    }
    return builder.build();
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:21,代碼來源:CollectorLogbackAppender.java

示例4: append

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent event) {
    event.prepareForDeferredProcessing();
    //todo do more elegant streaming approach to publish logs

    if (!event.getLevel().equals(Level.ALL) &&         // OFF AND ALL are not loggable levels
            !event.getLevel().equals(Level.OFF)) {
        final IThrowableProxy throwableProxy = event.getThrowableProxy();
        final LogEntry entry = throwableProxy != null ?
                new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(),
                        event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(),
                        event.getThreadName() != null ? event.getThreadName() : null,
                        new Exception(throwableProxy.getMessage(), toStringArray(throwableProxy.getStackTraceElementProxyArray())
                        , throwableProxy.getClassName()))
                : new LogEntry(serverId, event.getFormattedMessage(), Instant.ofEpochMilli(event.getTimeStamp()).toString(),
                event.getLevel().toString(), event.getLoggerName(), event.getMDCPropertyMap(),
                event.getThreadName() != null ? event.getThreadName() : null);
        producer.send(new ProducerRecord<>(kafkaTopic, new Gson().toJson(entry)));
    }
}
 
開發者ID:apache,項目名稱:airavata,代碼行數:21,代碼來源:KafkaAppender.java

示例5: exceptionInformation

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
/**
 * Pull out details of exception in a Hashmap (if they exist)
 * 
 * @param loggingEvent
 * @return
 */
protected void exceptionInformation(
    final ILoggingEvent loggingEvent) {
    final IThrowableProxy throwableInformation = loggingEvent
            .getThrowableProxy();
    if (throwableInformation != null) {
        if (throwableInformation.getClassName() != null) {
            ExceptionField.put(EXCEPTION.CLASS, throwableInformation.getClassName());
        }
        if (throwableInformation.getMessage() != null) {
            ExceptionField.put(EXCEPTION.MESSAGE, throwableInformation.getMessage());
        }
        if (throwableInformation.getStackTraceElementProxyArray() != null) {
            final String stackTrace = StringUtils.join(
                    throwableInformation.getStackTraceElementProxyArray(), "\n");
            ExceptionField.put(EXCEPTION.STACKTRACE, stackTrace);
        }
    }
}
 
開發者ID:stuart-warren,項目名稱:logit,代碼行數:25,代碼來源:Layout.java

示例6: containsMessage

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private boolean containsMessage(IThrowableProxy exception, String exceptionName) {
    final String message = exception.getMessage();
    if (message != null && message.contains(exceptionAndMessage.get(exceptionName))) {
        return true;
    }
    return false;
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:8,代碼來源:ExpectedExceptionAppender.java

示例7: DefaultLogThrowable

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
DefaultLogThrowable(IThrowableProxy throwableProxy) {
  this.className = throwableProxy.getClassName();
  this.message = throwableProxy.getMessage();

  StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
  this.stackTraces = new StackTraceElement[stackTraceElementProxyArray.length];
  for (int i = 0; i < stackTraceElementProxyArray.length; i++) {
    stackTraces[i] = stackTraceElementProxyArray[i].getStackTraceElement();
  }

  cause = (throwableProxy.getCause() == null) ? null : new DefaultLogThrowable(throwableProxy.getCause());
}
 
開發者ID:apache,項目名稱:twill,代碼行數:13,代碼來源:DefaultLogThrowable.java

示例8: Event

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
Event(ILoggingEvent event) {
    this.marker = event.getMarker();
    this.level = event.getLevel().toString();
    this.message = event.getMessage();
    this.arguments = event.getArgumentArray();
    final IThrowableProxy proxy = event.getThrowableProxy();
    this.thrown = proxy == null ? null : proxy.getClassName() + ": " + proxy.getMessage();
}
 
開發者ID:jhipster,項目名稱:jhipster,代碼行數:9,代碼來源:LogbackRecorder.java

示例9: parseStringArrayMessage

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private String parseStringArrayMessage(IThrowableProxy throwableProxy) {
    String throwableClassName = throwableProxy.getClassName();
    String throwableMessage = throwableProxy.getMessage();
    StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
    logger.debug("Parse exception message with"
            + stackTraceElementProxyArray.length + "elements to create the correct crash log file.");
    StringBuffer buffer = new StringBuffer();
    createFirstLine(throwableClassName, throwableMessage, buffer);

    for (StackTraceElementProxy stackColumn : stackTraceElementProxyArray) {
        buffer.append("\t").append(stackColumn.getSTEAsString()).append("\n");
    }
    return buffer.toString();
}
 
開發者ID:codewinkel,項目名稱:logback-extensions,代碼行數:15,代碼來源:HockeyAppCrashAppenderService.java

示例10: getExceptionInfo

import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private String getExceptionInfo(IThrowableProxy iThrowableProxy) {
    String s = iThrowableProxy.getClassName();
    String message = iThrowableProxy.getMessage();
    return (message != null) ? (s + ": " + message) : s;
}
 
開發者ID:aliyun,項目名稱:aliyun-log-logback-appender,代碼行數:6,代碼來源:LoghubAppender.java


注:本文中的ch.qos.logback.classic.spi.IThrowableProxy.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。