GH-340: Fix logging for WebSocket server side
Fixes https://github.com/spring-projects/spring-integration-samples/issues/340 The `LoggingHandler` uses a `org.springframework.integration.handler` category by default. So, the `info` provided for the `loggingChannelAdapter` service activator does not have any effects because `logback.xml` has an `ERROR` for the `org.springframework.integration` category * Use dedicated `wsLog` category in the `LoggingHandler` bean definition to print a server message published to the subscribed web socket clients
This commit is contained in:
@@ -128,6 +128,7 @@ public class Application {
|
||||
@ServiceActivator(inputChannel = "sendTimeChannel")
|
||||
public MessageHandler loggingChannelAdapter() {
|
||||
LoggingHandler loggingHandler = new LoggingHandler("info");
|
||||
loggingHandler.setLoggerName("wsLog");
|
||||
loggingHandler.setLogExpressionString(
|
||||
"'The time ' + payload + ' has been sent to the WebSocketSession ' + headers.simpSessionId");
|
||||
return loggingHandler;
|
||||
|
||||
Reference in New Issue
Block a user