refactor: Set logging-level for io.projectreactor to `DEBUG`
authorKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 10:43:00 +0000 (11:43 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 14:28:35 +0000 (15:28 +0100)
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java
src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java

index 070abf2..1a8711a 100644 (file)
@@ -10,6 +10,7 @@ import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
 import java.util.UUID;
+import java.util.logging.Level;
 
 
 @RestController
@@ -118,7 +119,10 @@ public class ChatBackendController
   {
     return chatRoomData
         .listen()
-        .log()
+        .log(
+            ChatBackendController.class.getSimpleName(),
+            Level.FINE,
+            true)
         .map(message -> MessageTo.from(message))
         .map(messageTo ->
             ServerSentEvent
index cdb4f0d..fd8939b 100644 (file)
@@ -17,6 +17,7 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.UUID;
+import java.util.logging.Level;
 
 import static java.nio.file.StandardOpenOption.CREATE;
 import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
@@ -49,7 +50,10 @@ public class FilesStorageStrategy implements StorageStrategy
               .createGenerator(Files.newBufferedWriter(path, CREATE, TRUNCATE_EXISTING));
 
       return chatRoomInfoFlux
-          .log()
+          .log(
+              FilesStorageStrategy.class.getSimpleName(),
+              Level.FINE,
+              true)
           .doFirst(() ->
           {
             try
@@ -100,7 +104,10 @@ public class FilesStorageStrategy implements StorageStrategy
     JavaType type = mapper.getTypeFactory().constructType(ChatRoomInfoTo.class);
     return Flux
         .from(new JsonFilePublisher<ChatRoomInfoTo>(chatroomsPath(), mapper, type))
-        .log()
+        .log(
+            FilesStorageStrategy.class.getSimpleName(),
+            Level.FINE,
+            true)
         .map(chatRoomInfoTo ->
         {
           UUID chatRoomId = chatRoomInfoTo.getId();
@@ -136,7 +143,10 @@ public class FilesStorageStrategy implements StorageStrategy
               .createGenerator(Files.newBufferedWriter(path, CREATE, TRUNCATE_EXISTING));
 
       return messageFlux
-          .log()
+          .log(
+              FilesStorageStrategy.class.getSimpleName(),
+              Level.FINE,
+              true)
           .doFirst(() ->
           {
             try
@@ -187,7 +197,10 @@ public class FilesStorageStrategy implements StorageStrategy
     JavaType type = mapper.getTypeFactory().constructType(MessageTo.class);
     return Flux
         .from(new JsonFilePublisher<MessageTo>(chatroomPath(chatRoomId), mapper, type))
-        .log()
+        .log(
+            FilesStorageStrategy.class.getSimpleName(),
+            Level.FINE,
+            true)
         .map(MessageTo::toMessage);
   }