最佳答案
使用 SLF4J记录错误消息和异常的正确方法是什么?
我试过这样做,但是异常堆栈跟踪从未打印出来:
logger.error("Unable to parse data {}", inputMessage, e);
在这种情况下,我想用 inputMessage
填充 {}
,并注销异常堆栈跟踪。
我能想到的唯一办法就是这么做:
logger.error("Unable to parse data " + inputMessage, e);
这可不好看。