2
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger log = LoggerFactory.getLogger(Twitter.class);
} catch (TwitterException e) {
// It prints the message as well as the exception
// log.error("Unable to show status", e);
// I would like to pass a status as well as an exception
// Is this an appropriate log statement
String status = "failed";
log.error("Unable to show status {}", status, e);
}
上述log.error语句是log.error的变体,上述语句是否正常工作。我也不确定,因为我也通过了“地位”。请澄清如何格式化错误日志中的变量和异常