Spring集成 – 网关 – 重试日志

huangapple go评论61阅读模式
英文:

Spring integration - Gateway - Retry logging

问题

我在sftpOutboundGateway上应用了重试策略。我想在日志中查看重试发生的情况。如何启用这个功能?在application.yml文件中是否有相关属性?

英文:

I have a retry advice applied on a sftpOutboundGateway. I want to see in the logs whenever retries happen. how do I enable that ? is there some property in application.yml ?

答案1

得分: 1

我猜您正在使用Spring Boot,因为您提到了application.yml。确实,Spring Boot允许我们在配置属性中配置日志类别。以下是Spring Retry的配置示例:

logging.level.org.springframework.retry: debug

使用此配置,您将看到来自RetryTemplate的一些活动信息:

  • 重试:次数=
  • 检查是否重新抛出:次数=
  • 重试失败的最后一次尝试:次数=

请参阅Spring Boot文档:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.log-levels

英文:

Since you talk about an application.yml, I just guess that you use Spring Boot. Indeed Spring Boot allows us to configure logging categories in that configuration properties. And here is the one for Spring Retry:

logging.level.org.springframework.retry:debug

With that you'll see some activities from the RetryTemplate:

Retry: count=

Checking for rethrow: count=

Retry failed last attempt: count=

See Spring Boot docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.logging.log-levels

huangapple
  • 本文由 发表于 2023年2月6日 10:04:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75356776.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定