The %ex and %xEx define a stack trace length. The integer spec is somewhat faulty and misleading. First of all this is a stack trace depth imho and not length. Anyway, I was poking around with the SMTPAppender and wanted to include the sole exception message into the subject. The outcome was:
1. The docs do not define a valid interval for the integer value. You can only deduce from logic.
2. I defined %ex
and it included 2 lines of the stack trace.
3. I defined %ex
and it included 3 lines of the stack trace.
4. I defined %ex
and it included 1 line of the stack trace.
5. Defining any negative number omits the stack trace. But it does not make sense at all to have a negative stack trace depth.
I checked also the source of the https://github.com/ceki/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java converter, the lines 54 and 58 cause the problem.