gpt4 book ai didi

java - 为什么 Camel noErrorHandler 使用堆栈跟踪记录警告消息?

转载 作者:行者123 更新时间:2023-12-01 09:33:02 26 4
gpt4 key购买 nike

我们使用 Camel 2.15.4 将 Swing 客户端连接到 OSGi 服务器。

在服务器中,在某些情况下,我们会抛出 RuntimeException 的子类,我们希望将其传播回客户端。

在构建路线时,我们使用:

errorHandler(noErrorHandler());

但是每次我们抛出这些服务器错误之一时,我们都会收到一 strip 有完整堆栈跟踪的警告日志消息。测试人员发现这些日志消息相当令人不安,因为它们看起来像是问题。

有什么方法可以关闭这些警告的记录吗?

这是一个例子:

16:37:12,565 | WARN  | che.camel.camel-core | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException]
org.apache.camel.RuntimeCamelException: xxxxxx.yyyyyyy.exceptions.CustomException: blah
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1619)
at org.apache.camel.component.bean.BeanInvocation.invoke(BeanInvocation.java:87)
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:134)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:68)
at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:38)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at uniworks.camel.interceptor.CamelInterceptor$1.process(CamelInterceptor.java:79)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103)[58:org.apache.camel.camel-jms:2.15.4]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:569)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:507)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:474)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992)[176:org.apache.servicemix.bundles.spring-jms:3.2.14.RELEASE_1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_92]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_92]

在我们的服务器的先前版本(使用 Camel 2.11.0 和 Spring DSL)中,我们定义了路由上下文:

<camel:errorHandler id="noErrorHandler" type="NoErrorHandler"/>

<camel:camelContext id="blah_camel" errorHandlerRef="noErrorHandler">
.....

我们没有收到这些警告日志消息。

最佳答案

这实际上不是 Camel 的无错误处理程序执行此日志记录,而是 JMS 组件。 JMS 组件具有一些异常的回退日志记录,以指示 JMS 消息未成功处理。您可以在 JMS 组件/端点上看到两个选项:errorHandlerLoggingLevelerrorHandlerLogStackTrace,您可以关闭/配置它们:http://camel.apache.org/jms

关于java - 为什么 Camel noErrorHandler 使用堆栈跟踪记录警告消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39241103/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com