我的電腦重新啟動,我的應用程序今天不再運行。昨天還在工作。除了 Maven 下載新庫(主要是 Amazon)之外,沒有任何改變?,F在我什至無法訪問該/admin/login頁面。如何調試請求?2019-09-13 17:26:16.924 INFO 2056 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/admin/login],methods=[GET]}" onto public java.lang.String com.s.s.controller.Controller.login()2019-09-13 17:26:21.465 ERROR 2056 --- [nio-8080-exec-1] c.s.s.c.Controller : invalidRequest(): invalid request: /admin/login@RequestMapping(value="/admin/login", method=RequestMethod.GET)public String login() { return "login";}@RequestMapping("/error")public void invalidRequest(HttpServletRequest request, HttpServletResponse response){ Logger.error(TAG, "invalidRequest()", "invalid request: " + request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI)); try { response.setStatus(HttpStatus.OK.value()); response.getWriter().write("This is not a valid request"); } catch (IOException e) { Logger.error(TAG, "invalidRequest: ", "Exception in invalidRequest() method "+e.getMessage()); }}@Overridepublic String getErrorPath() { return "/error";}我設置了這一行,application.properties但它沒有打印任何額外的內容。logging.level.com.s.s.controller.Controller=DEBUG我運行mvn clean并重新啟動服務器,但沒有幫助。我設置了這一行,application.properties但它沒有打印任何有用的內容。debug=true我在 Makgigrahul 的答案中找到了以下搜索內容spring-sleuth,并將其添加到application.properties生成此日志中。logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG
2 回答

肥皂起泡泡
TA貢獻1829條經驗 獲得超6個贊
您可以嘗試在org.apache.catalina.core.ApplicationFilterChain#doFilter中設置斷點。這在請求處理的開始階段非常好?;蛘吣憧梢钥纯?org.springframework.web.servlet.DispatcherServlet#doDispatch

絕地無雙
TA貢獻1946條經驗 獲得超4個贊
我能夠使用 Andreas 的答案進行調試,并看到了值request.request.filterChain.filters[]
并看到了我的過濾器remoteAddressFilter()
和鋸子remoteAddress = 0:0:0:0:0:0:0:1
。我有一個 IP 過濾器 (?RemoteAddrFilter
),允許的值之一是127.0.0.1
.?我正在使用 訪問服務器http://localhost:8080/admin/home
,它顯然使用 IP6 地址??赡苁侵匦聠佑嬎銠C的 Windows 更新改變了網絡行為。當我使用時http://127.0.0.1:8080/admin/home
它有效。我想向過濾器添加日志記錄以在被阻止時發出通知,但沒有明顯的方法。Amazing Spring 不會在調試模式下記錄過濾器。
添加回答
舉報
0/150
提交
取消