本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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)));
}
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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();
}
示例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();
}
示例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;
}