org.slf4j用法:
/*
Scala
*/
//1.创建Logger对象.
private val logger:Logger = LoggerFactory.getLogger(classOf[HttpBmlClient])
//2.打印错误信息,同时抛出异常.
logger.error(s"path $path not exists")
throw IllegalPathException()
/*
Java
*/
//1.创建Logger对象.
private static final Logger logger = LoggerFactory.getLogger(HdfsResourceHelper.class);
//2.打印错误信息,同时抛出异常.
logger.error("{} write to {} failed, reason is, IOException:", user, path, e);
UploadResourceException uploadResourceException = new UploadResourceException();
uploadResourceException.initCause(e);
throw uploadResourceException;