简体   繁体   English

如何防止在 Spring Boot 的控制台中打印“重试策略耗尽”异常?

[英]How to prevent 'Retry Policy Exhausted' Exception to be print in console of spring boot?

I am using spring boot and I am trying to get my own messages on console file if any exception occurs.我正在使用 spring boot,如果发生任何异常,我试图在控制台文件上获取我自己的消息。 But I am getting also other messages too from RabbitMQ like:但我也从 RabbitMQ 收到其他消息,例如:

org.springframework.amqp.rabbit.support.ListenerExecutionFailedException

org.springframework.amqp.rabbit.support.ListenerExecutionFailedException: Retry Policy Exhausted

Caused by: org.springframework.amqp.AmqpRejectAndDontRequeueException: null

These are the messages which I don't want to be print on log file because it will make log file messy and contains more memory.这些是我不想在日志文件上打印的消息,因为它会使日志文件变得混乱并包含更多内存。

Is there any way to prevent from these messages to not to be printed.有什么办法可以防止这些消息不被打印。

Why are you getting this error?你为什么会收到这个错误? Maybe you need to fix that error so that this log do not appear.也许您需要修复该错误,以免出现此日志。

But still if you want to turn off this log then add this logger in your logback.xml to turn off logging from that class但是如果你想关闭这个日志然后在你的logback.xml添加这个记录器来关闭那个类的日志记录

<logger name="org.springframework.amqp.rabbit.retry" level="OFF"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM