|
@@ -3,6 +3,7 @@ package com.gis.admin.controller;
|
|
|
import com.gis.common.base.exception.BaseRuntimeException;
|
|
|
import com.gis.common.util.Result;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.shiro.ShiroException;
|
|
|
import org.apache.shiro.authz.UnauthorizedException;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
@@ -24,7 +25,7 @@ import java.io.StringWriter;
|
|
|
* 统一捕捉异常,自定义返回参数
|
|
|
* 这里只可以捕获controller层的异常。
|
|
|
*/
|
|
|
-@Log4j2
|
|
|
+@Slf4j
|
|
|
@RestControllerAdvice
|
|
|
public class ExceptionController {
|
|
|
|
|
@@ -54,7 +55,7 @@ public class ExceptionController {
|
|
|
@ExceptionHandler(Exception.class)
|
|
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
|
|
public Result globalException(HttpServletRequest request, Throwable ex) {
|
|
|
- log.error(ex);
|
|
|
+ log.error(ex.toString());
|
|
|
return Result.failure(getStatus(request).value(), ex.getMessage());
|
|
|
}
|
|
|
|
|
@@ -133,7 +134,7 @@ public class ExceptionController {
|
|
|
private void printErrorMsg(BaseRuntimeException e){
|
|
|
StringWriter trace=new StringWriter();
|
|
|
e.printStackTrace(new PrintWriter(trace));
|
|
|
- log.error(trace);
|
|
|
+ log.error(trace.toString());
|
|
|
}
|
|
|
|
|
|
|