From 2669eed1aea8945d68a9883aba43d7830c71e161 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 1 Mar 2024 17:04:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(configuration):=20=E8=BE=93=E5=87=BAhttp?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/controller/GlobalErrorController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/controller/GlobalErrorController.java b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/controller/GlobalErrorController.java index a4c76f3..8a6db85 100644 --- a/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/controller/GlobalErrorController.java +++ b/service-configuration/src/main/java/com/lanyuanxiaoyao/service/configuration/controller/GlobalErrorController.java @@ -1,5 +1,7 @@ package com.lanyuanxiaoyao.service.configuration.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -14,10 +16,13 @@ import org.springframework.web.bind.annotation.ResponseStatus; */ @ControllerAdvice public class GlobalErrorController { + private static final Logger logger = LoggerFactory.getLogger(GlobalErrorController.class); + @ResponseBody @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ExceptionHandler(Throwable.class) public String errorHandler(Throwable throwable) { + logger.error("Error", throwable); return throwable.getMessage(); } }