I have some specific problem with logback. We've migrated from log4j to logback and all seems to be alright, but we have an exception class MultiCauseException. As you guessed - it can have more than one cause exception, so the problem is: I can't manually format stacktrace to see all causes.
Why it was working. Log4j used method printStackTrace() and you can override it in MultiCauseException and the problem is gone. But logback uses his own methods and I don't know how to replace them.
I want to log all causes correctly.
In class I have
MultiCauseException nextInChain; // my cause
Throwable inner;
// the real exception (inner.getCause() can be != null - must be logged)
And
@Override
public Throwable getCause() {
return nextInChain;
}
Logback has something called Layouts that is suppoesed to format events to strings . But I still believe you should be able to configure it with PatternLayout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With