From: Kai Moritz Date: Tue, 20 Feb 2024 10:43:00 +0000 (+0100) Subject: refactor: Set logging-level for io.projectreactor to `DEBUG` X-Git-Tag: rebase--2024-02-20--15-07~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=7f4b3b50dc9b2a976eb1fa06b0ac72eb840d4811;p=demos%2Fkafka%2Fchat refactor: Set logging-level for io.projectreactor to `DEBUG` --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java index acb84e64..e5b4b5a2 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java +++ b/src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java @@ -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 diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java index cdb4f0d7..fd8939b6 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/files/FilesStorageStrategy.java @@ -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(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(chatroomPath(chatRoomId), mapper, type)) - .log() + .log( + FilesStorageStrategy.class.getSimpleName(), + Level.FINE, + true) .map(MessageTo::toMessage); }