瀏覽代碼

日志格式修改

wangmh 7 年之前
父節點
當前提交
27c7bdafb1
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      sso-server/src/main/java/com/uas/sso/web/advice/ExceptionHandlerAdvice.java

+ 2 - 2
sso-server/src/main/java/com/uas/sso/web/advice/ExceptionHandlerAdvice.java

@@ -28,7 +28,7 @@ public class ExceptionHandlerAdvice {
 	 */
 	 */
 	@ExceptionHandler(RuntimeException.class)
 	@ExceptionHandler(RuntimeException.class)
 	public ResponseEntity<ModelMap> handleRuntimeException(RuntimeException ex) {
 	public ResponseEntity<ModelMap> handleRuntimeException(RuntimeException ex) {
-		logger.error("RuntimeException", ex);
+        logger.warn("{}: {}", ex.getClass().getName(), ex.getMessage());
 		HttpHeaders headers = new HttpHeaders();
 		HttpHeaders headers = new HttpHeaders();
 		headers.add("Content-Type", "application/json; charset=utf-8");
 		headers.add("Content-Type", "application/json; charset=utf-8");
 		return new ResponseEntity<ModelMap>(error(ex.getMessage()), headers, HttpStatus.OK);
 		return new ResponseEntity<ModelMap>(error(ex.getMessage()), headers, HttpStatus.OK);
@@ -42,7 +42,7 @@ public class ExceptionHandlerAdvice {
 	 */
 	 */
 	@ExceptionHandler(VisibleError.class)
 	@ExceptionHandler(VisibleError.class)
 	public ResponseEntity<ModelMap> handleVisibleError(VisibleError ex) {
 	public ResponseEntity<ModelMap> handleVisibleError(VisibleError ex) {
-        logger.warn("VisibleError", ex.getMessage());
+        logger.warn("{}: {}", ex.getClass().getName(), ex.getMessage());
 		HttpHeaders headers = new HttpHeaders();
 		HttpHeaders headers = new HttpHeaders();
 		headers.add("Content-Type", "application/json; charset=utf-8");
 		headers.add("Content-Type", "application/json; charset=utf-8");
 		return new ResponseEntity<ModelMap>(error(ex.getMessage()), headers, HttpStatus.OK);
 		return new ResponseEntity<ModelMap>(error(ex.getMessage()), headers, HttpStatus.OK);