slf4j日志中的palceholder 发表于 2018-07-10 | 评论: | 阅读次数: 1234567891011121314151617181920212223// Goodlogger.error("Logger1: ", e);[main] ERROR - Logger1: java.lang.NullPointerException at com.kaven.test.logger.PlaceHolderTest.main(PlaceHolderTest.java:11)// 占位符不能解析logger.error("Logger2: {}", e);[main] ERROR - Logger2: {}java.lang.NullPointerException at com.kaven.test.logger.PlaceHolderTest.main(PlaceHolderTest.java:11)// 占位符能解析,但是没有了堆栈信息(使用了toString())logger.error("Logger2: {}, {}", 3, e);[main] ERROR - Logger2: 3, java.lang.NullPointerException // toString()logger.error("Logger3: " + e);[main] ERROR - Logger3: java.lang.NullPointerException// getMessage()logger.error("Logger4: " + e.getMessage());[main] ERROR - Logger4: null