The following converter (pattern) use CallerData to get the first stack trace element.
- ClassOfCallerConverter
- MethodOfCallerConverter
- LineOfCallerConverter
- FileOfCallerConverter
If I want to extend the SubstituteLogger to add utility methods then the first element of the stack will always be SubstituteLogger.
I think Logback should ignore SubstituteLogger from the stack trace element and take the next element.
<code>
for (StackTraceElement stackTraceElement : callerData) {
if (SubstituteLogger.class.getName().equals(stackTraceElement.getClassName()))
{
continue;
}
return stackTraceElement;
}
</code>
I know that I can create a custom layout or extend PatternLayout to replace the converter but I think Logback should do that by default.
|