logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

Uniformise `%ex` pattern and `exception` JTL resolver

Open ppkarwasz opened this issue 6 months ago • 0 comments

Description

Currently there is a difference in the way exceptions are formatted by the %ex pattern converter and the following JSON Template Layout snippet:

{
  "$resolver": "exception",
  "field": "stackTrace",
  "stackTrace": {
    "stringified": true
  }
}
  • JTL simply uses Throwable.printStackTrace() and the first line of the output is obtained by calling Object.toString().
  • Pattern Layout uses getClass().getName() + ": " + getLocalisedMessage().

Those lines agree, unless an exception overrides Object#toString().

ppkarwasz avatar Apr 17 '25 14:04 ppkarwasz