Closed quhw closed 9 years ago
I am building the log forwarder which forwards the LoggingEventVO to a GelfAppender. But the event has no callerData, so that the GelfConverter does not work.
We should check if hasCallerData before using it.
private void stackTraceField(Map<String, Object> map, ILoggingEvent eventObject) { IThrowableProxy throwableProxy = eventObject.getThrowableProxy(); if (throwableProxy != null ) { StackTraceElementProxy[] proxyStackTraces = throwableProxy.getStackTraceElementProxyArray(); if (proxyStackTraces != null && proxyStackTraces.length > 0) { StackTraceElement[] callStackTraces = eventObject.getCallerData(); if (callStackTraces.length > 0) { StackTraceElement lastStack = callStackTraces[0]; map.put("file", lastStack.getFileName()); map.put("line", String.valueOf(lastStack.getLineNumber())); } } } }
Thanks!
I am building the log forwarder which forwards the LoggingEventVO to a GelfAppender. But the event has no callerData, so that the GelfConverter does not work.
We should check if hasCallerData before using it.