错误
logger.warn("table为null,actionType:{},original:{}",actionType,value.getOriginal)
Error:(70, 14) ambiguous reference to overloaded definition,
both method warn in trait Logger of type (x$1: String, x$2: Any, x$3: Any)Unit
and method warn in trait Logger of type (x$1: String, x$2: Object*)Unit
match argument types (String,String,String)
logger.warn("table为null,actionType:{},original:{}",actionType,value.getOriginal)
正确:
logger.warn("table为null,actionType:{},original:{}",Array(actionType,value.getOriginal):_*)
slf4j 正确的日志打印异常堆栈的方式
@Test
public void testError() {
String s = null;
try {
s.length();
} catch (Exception e) {
log.error(s, e);
//当然如果你懒得想提示信息的话,直接这样log.error("", e);
}
}
网友评论