ソースを参照

优化日志打印

zhouhao 2 年 前
コミット
7529d9201f

+ 6 - 1
hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/CompositeReactiveAuthenticationManager.java

@@ -1,6 +1,7 @@
 package org.hswebframework.web.authorization.simple;
 
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.hswebframework.web.authorization.*;
 import reactor.core.publisher.Flux;
@@ -11,6 +12,7 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @AllArgsConstructor
+@Slf4j
 public class CompositeReactiveAuthenticationManager implements ReactiveAuthenticationManager {
 
     private final List<ReactiveAuthenticationManagerProvider> providers;
@@ -34,7 +36,10 @@ public class CompositeReactiveAuthenticationManager implements ReactiveAuthentic
                                     .stream()
                                     .map(manager -> manager
                                             .getByUserId(userId)
-                                            .onErrorResume((err) -> Mono.empty())
+                                            .onErrorResume((err) -> {
+                                                log.warn("get user [{}] authentication error", userId, err);
+                                                return Mono.empty();
+                                            })
                                     ))
                 .flatMap(Function.identity())
                 .collectList()

+ 2 - 3
hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/RedisReactiveCache.java

@@ -64,9 +64,8 @@ public class RedisReactiveCache<E> implements ReactiveCache<E> {
     }
 
     protected <T> Mono<T> handleError(Throwable error) {
-        return Mono.fromRunnable(() -> {
-            log.error(error.getMessage(), error);
-        });
+        log.error(error.getMessage(), error);
+        return Mono.empty();
     }
 
     @Override

+ 3 - 2
hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/UnSupportedReactiveCache.java

@@ -15,10 +15,11 @@ import java.util.function.Supplier;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public class UnSupportedReactiveCache<E> implements ReactiveCache<E> {
 
-    private static final UnSupportedReactiveCache INSTANCE = new UnSupportedReactiveCache();
+    private static final UnSupportedReactiveCache<?> INSTANCE = new UnSupportedReactiveCache<>();
 
+    @SuppressWarnings("all")
     public static <E> ReactiveCache<E> getInstance() {
-        return INSTANCE;
+        return (UnSupportedReactiveCache)INSTANCE;
     }
 
     @Override