【发布时间】:2020-08-12 17:04:01
【问题描述】:
我找不到任何关于 Olingo v4 系统日志的信息,比如 spring boot。 教程包含slf4j,所以framework里面必须有内部日志
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
但我无法在教程或示例代码中找到任何日志配置。 我想使用 log4j2 进行日志记录,我希望在 web.xml 中使用特定参数,就像它在 spring boot 中一样工作
<context-param>
<param-name>log4jConfiguration</param-name>
<param-value>log4j2.properties</param-value>
</context-param>
此外,我找到了 v2 的 ODataDebugCallback 实现 - Debug Support and Error Handling
但它适用于 v2,不适用于 v4
是否有任何上下文参数可供使用或类似于 ODataDebugCallback 的东西用于日志记录?
小案例说明。
我在数据库之上创建了 Olingo v4 OData API。其中一个关键特性是动态元数据构建。它最初工作得很好,但是当我创建新表时,我得到了
{
"error": {
"code": null,
"message": "OData Library: An exception without message text was thrown."
}
}
OData servlet 中没有任何问题
try {
/*session, storage, handler, edm providers init here*/
// let the handler do the work
handler.process(req, resp);
} catch (Exception e) {
log.error("Server Error occurred in ODataServlet", e); //app is not getting here
throw new ServletException(e);
} finally {
log.debug("========== Request end ==========");
}
还有我的日志
[DEBUG] ODataServlet - ========== Request begin ==========
[DEBUG] ODataServlet - Received GET request /myOdataServer.svc/$metadata from 0:0:0:0:0:0:0:1
[DEBUG] JDBCFactory - Opening connection to jdbc:postgresql://host/card_storage
[DEBUG] ODataServlet - ========== Request end ==========
我希望从框架中获得更多关于错误的信息:堆栈跟踪、行号等。
【问题讨论】: