【发布时间】:2020-11-08 02:44:53
【问题描述】:
这是我的过滤器代码
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
String path = ((HttpServletRequest) request).getRequestURI();
LOGGER.log(Level.INFO, "Current request path :: {0}", path);
if (ignorePath(path)) {
LOGGER.log(Level.INFO, "continuing to next filter");
chain.doFilter(request, response);
}
LOGGER.log(Level.INFO, "Should not come here");
}
日志记录仅用于调试目的。 我正在执行以下日志。
2020-07-18T12:02:30.805301+00:00 app[web.1]:2020 年 7 月 18 日下午 12:02:30 security.filter.SecurityFilter doFilter
2020-07-18T12:02:30.805302+00:00 app[web.1]:INFO:继续下一个过滤器
2020-07-18T12:02:30.889518+00:00 app[web.1]:2020 年 7 月 18 日 12:02:30 PM security.filter.SecurityFilter doFilter
2020-07-18T12:02:30.889520+00:00 app[web.1]:信息:不应该来这里
这里到底出了什么问题?日志不应该来这里,不应该被打印(这是我所期望的)。
【问题讨论】:
标签: servlets jax-rs servlet-filters