Skip to content

Commit

Permalink
fix(log): print java exception stack trace in logger (#19814)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikeW authored Dec 16, 2024
1 parent 492e2d7 commit 4ed93eb
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,23 @@ private void logIfEnabled(int level, String msg) {

private void logIfEnabled(int level, String format, Object arg) {
if (TracingSlf4jImpl.isEnabled(level)) {
TracingSlf4jImpl.event(
name, level, new ParameterizedMessage(format, arg).getFormattedMessage());
var pm = new ParameterizedMessage(format, arg);
if (null != pm.getThrowable()) {
logIfEnabled(level, pm.getFormattedMessage(), pm.getThrowable());
} else {
TracingSlf4jImpl.event(name, level, pm.getFormattedMessage());
}
}
}

private void logIfEnabled(int level, String format, Object arg1, Object arg2) {
if (TracingSlf4jImpl.isEnabled(level)) {
TracingSlf4jImpl.event(
name,
level,
new ParameterizedMessage(format, arg1, arg2).getFormattedMessage());
var pm = new ParameterizedMessage(format, arg1, arg2);
if (null != pm.getThrowable()) {
logIfEnabled(level, pm.getFormattedMessage(), pm.getThrowable());
} else {
TracingSlf4jImpl.event(name, level, pm.getFormattedMessage());
}
}
}

Expand Down

0 comments on commit 4ed93eb

Please sign in to comment.