本文整理匯總了Java中ch.qos.logback.classic.spi.IThrowableProxy.getStackTraceElementProxyArray方法的典型用法代碼示例。如果您正苦於以下問題:Java IThrowableProxy.getStackTraceElementProxyArray方法的具體用法?Java IThrowableProxy.getStackTraceElementProxyArray怎麽用?Java IThrowableProxy.getStackTraceElementProxyArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ch.qos.logback.classic.spi.IThrowableProxy
的用法示例。
在下文中一共展示了IThrowableProxy.getStackTraceElementProxyArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fullDump
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
public String fullDump(ILoggingEvent evt) {
try {
IThrowableProxy proxy = evt.getThrowableProxy();
if(proxy == null)
return null;
StringBuilder builder = new StringBuilder();
for (StackTraceElementProxy step : proxy
.getStackTraceElementProxyArray()) {
String string = step.toString();
builder.append(CoreConstants.TAB).append(string);
ThrowableProxyUtil.subjoinPackagingData(builder, step);
builder.append(CoreConstants.LINE_SEPARATOR);
}
return builder.toString();
} catch(Exception e) {
addError("exception trying to log exception", e);
return "exception parsing exception";
}
}
示例2: render
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
void render(StringBuilder sbuf, IThrowableProxy tp) {
printFirstLine(sbuf, tp);
int commonFrames = tp.getCommonFrames();
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
for (int i = 0; i < stepArray.length - commonFrames; i++) {
StackTraceElementProxy step = stepArray[i];
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(step.toString()));
sbuf.append(CoreConstants.LINE_SEPARATOR);
}
if (commonFrames > 0) {
sbuf.append(TRACE_PREFIX);
sbuf.append("\t... ").append(commonFrames).append(" common frames omitted").append(CoreConstants.LINE_SEPARATOR);
}
}
示例3: render
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
void render(StringBuilder sbuf, IThrowableProxy tp) {
printFirstLine(sbuf, tp);
int commonFrames = tp.getCommonFrames();
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
for (int i = 0; i < stepArray.length - commonFrames; i++) {
StackTraceElementProxy step = stepArray[i];
sbuf.append(TRACE_PREFIX);
sbuf.append(Transform.escapeTags(step.toString()));
sbuf.append(CoreConstants.LINE_SEPARATOR);
}
if (commonFrames > 0) {
sbuf.append(TRACE_PREFIX);
sbuf.append("\t... ").append(commonFrames).append(" common frames omitted")
.append(CoreConstants.LINE_SEPARATOR);
}
}
示例4: subjoinThrowableProxy
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
void subjoinThrowableProxy(StringBuilder buf, IThrowableProxy tp) {
subjoinFirstLine(buf, tp);
buf.append(CoreConstants.LINE_SEPARATOR);
final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
final int commonFrames = tp.getCommonFrames();
int maxIndex = stepArray.length;
if (commonFrames > 0) {
maxIndex -= commonFrames;
}
for (int i = 0; i < maxIndex; i++) {
final String string = stepArray[i].toString();
buf.append(PREFIX);
buf.append(string);
extraData(buf, stepArray[i]); // allow other data to be added
buf.append(CoreConstants.LINE_SEPARATOR);
}
if (commonFrames > 0) {
buf.append("!... ").append(tp.getCommonFrames()).append(
" common frames omitted").append(CoreConstants.LINE_SEPARATOR);
}
}
示例5: convertToStackTraces
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private List<StackTraceVO> convertToStackTraces(final IThrowableProxy throwableProxy) {
final StackTraceElementProxy[] stackTraceElementProxies = throwableProxy.getStackTraceElementProxyArray();
final List<StackTraceVO> stackTraces = Lists.newArrayList();
for (final StackTraceElementProxy stackTraceElementProxy : stackTraceElementProxies) {
final StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();
final StackTraceVO stackTrace = new StackTraceVO();
stackTrace.setMethod(stackTraceElement.getClassName() + "." + stackTraceElement.getMethodName());
stackTrace.setLineNumber(stackTraceElement.getLineNumber());
stackTrace.setFile(stackTraceElement.getFileName());
stackTrace.setInProject(configuration.isInProject(stackTraceElement.getClassName()));
stackTraces.add(stackTrace);
}
return stackTraces;
}
示例6: createThrowableData
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
/**
* fluentdサーバに転送するログデータに格納する例外情報を生成する。
*
* @param th 例外データ。
* @return 例外情報。
*/
private Map<String, Object> createThrowableData(IThrowableProxy th) {
Map<String, Object> data = new LinkedHashMap<>();
data.put("className", th.getClassName());
data.put("message", th.getMessage());
List<String> stackTrace = new ArrayList<>();
for (StackTraceElementProxy ste : th.getStackTraceElementProxyArray()) {
stackTrace.add(ste.toString());
}
data.put("stackTrace", stackTrace);
if (th.getCause() != null) {
data.put("cause", createThrowableData(th.getCause()));
}
return data;
}
示例7: 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();
}
示例8: 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);
}
}
}
示例9: dump
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
private String dump(IThrowableProxy throwableProxy) {
StringBuilder builder = new StringBuilder();
builder.append(throwableProxy.getClassName()).append(": ").append(throwableProxy.getMessage()).append(CoreConstants.LINE_SEPARATOR);
for (StackTraceElementProxy step : throwableProxy.getStackTraceElementProxyArray()) {
String string = step.toString();
builder.append(CoreConstants.TAB).append(string);
ThrowableProxyUtil.subjoinPackagingData(builder, step);
builder.append(CoreConstants.LINE_SEPARATOR);
}
return builder.toString();
}
示例10: 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());
}
示例11: subjoinSTEPArray
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
protected void subjoinSTEPArray(StringBuilder buf, int indent, IThrowableProxy tp) {
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
int commonFrames = tp.getCommonFrames();
boolean unrestrictedPrinting = lengthOption > stepArray.length;
int maxIndex = (unrestrictedPrinting) ? stepArray.length : lengthOption;
if (commonFrames > 0 && unrestrictedPrinting) {
maxIndex -= commonFrames;
}
int ignoredCount = 0;
for (int i = 0; i < maxIndex; i++) {
StackTraceElementProxy element = stepArray[i];
if (!isIgnoredStackTraceLine(element.toString())) {
ThrowableProxyUtil.indent(buf, indent);
printStackLine(buf, ignoredCount, element);
ignoredCount = 0;
buf.append(CoreConstants.LINE_SEPARATOR);
} else {
++ignoredCount;
if (maxIndex < stepArray.length) {
++maxIndex;
}
}
}
if (ignoredCount > 0) {
printIgnoredCount(buf, ignoredCount);
buf.append(CoreConstants.LINE_SEPARATOR);
}
if (commonFrames > 0 && unrestrictedPrinting) {
ThrowableProxyUtil.indent(buf, indent);
buf.append("... ").append(tp.getCommonFrames()).append(
" common frames omitted").append(CoreConstants.LINE_SEPARATOR);
}
}
示例12: postProcess
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
@Override
protected void postProcess(Object eventObject, OutputStream sw) {
if (throwableExcluded)
return;
ILoggingEvent event = (ILoggingEvent) eventObject;
IThrowableProxy tp = event.getThrowableProxy();
if (tp == null)
return;
String stackTracePrefix = stackTraceLayout.doLayout(event);
boolean isRootException = true;
while (tp != null) {
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
try {
handleThrowableFirstLine(sw, tp, stackTracePrefix, isRootException);
isRootException = false;
for (StackTraceElementProxy step : stepArray) {
StringBuilder sb = new StringBuilder();
sb.append(stackTracePrefix).append(step);
sw.write(sb.toString().getBytes());
sw.flush();
}
} catch (IOException e) {
break;
}
tp = tp.getCause();
}
}
示例13: addException
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
public static void addException(IThrowableProxy throwableProxy, String message, LogDataBuilder builder) {
if (throwableProxy != null) {
StringBuilder sb = new StringBuilder();
sb.append(message).append("\n");
sb.append(throwableProxy.getClassName()).append(": ").append(throwableProxy.getMessage()).append("\n");
for (StackTraceElementProxy stackTraceElementProxy : throwableProxy.getStackTraceElementProxyArray()) {
sb.append("\t").append(stackTraceElementProxy.getSTEAsString()).append("\n");
}
builder.withMessage(sb.toString());
}
}
示例14: buildRaygunStack
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
/**
* Builds a raygun stack trace from the given logback throwable proxy object.
* @param throwableProxy The logback throwable proxy.
* @return The raygun stack trace information.
*/
private static RaygunErrorStackTraceLineMessage[] buildRaygunStack(IThrowableProxy throwableProxy)
{
final StackTraceElementProxy[] proxies = throwableProxy.getStackTraceElementProxyArray();
final RaygunErrorStackTraceLineMessage[] lines = new RaygunErrorStackTraceLineMessage[proxies.length];
for (int i = 0; i < proxies.length; i++)
{
final StackTraceElementProxy step = proxies[i];
lines[i] = new RaygunErrorStackTraceLineMessage(step.getStackTraceElement());
}
return lines;
}
示例15: postProcess
import ch.qos.logback.classic.spi.IThrowableProxy; //導入方法依賴的package包/類
@Override
protected void postProcess(final Object eventObject, final OutputStream sw) {
if (isThrowableExcluded()) {
return;
}
final ILoggingEvent event = (ILoggingEvent) eventObject;
IThrowableProxy tp = event.getThrowableProxy();
if (tp == null) {
return;
}
final String stackTracePrefix = stackTraceLayout.doLayout(event);
boolean isRootException = true;
while (tp != null) {
final StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
try {
handleThrowableFirstLine(sw, tp, stackTracePrefix, isRootException);
isRootException = false;
for (final StackTraceElementProxy step : stepArray) {
final StringBuilder sb = new StringBuilder();
sb.append(stackTracePrefix).append(step);
sw.write(sb.toString().getBytes());
sw.flush();
}
} catch (IOException e) {
break;
}
tp = tp.getCause();
}
}