Skip to content
Advertisement

prevent org.springframework.messaging.MessagingException print stack trace

i am currently writing a websocket project using spring boot. And i have a websocket authentication config as this:

JavaScript

as you can see, i throw a messagingException inside configureClientInboundChannel method. The problem is this exception keep print stack trace in console like this:

JavaScript

is there any solution for me to prevent the print stack trace. Thank you

Advertisement

Answer

Question is a bit old, but I faced the same problem and found a workaround.

After debugging, I noticed its the StompSubProtocolHandler who prints this stack trace on the console:

JavaScript

So I just set the logging level of the class to OFF. Just put this on application.properties:

JavaScript

Note that this will hide ALL errors from StompSubProtocolHandler.

In my case this is not a problem because all of StompSubProtocolHandler’s errors are connection problems caused by clients bad internet connection.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement