Hi If you refer to <log>
<log id="logIncomingMsg" logName="com.mypackage"
loggingLevel="ERROR" message="Pushing to backout queue"/>
As something that is supposed to be parsed by that spring code, then that
is not.
The <log> is Log EIP and not really part of the error handler.
The following options is what configures how "verbose" the error handler is
when it executes and what it logs
retryAttemptedLogLevel="WARN"
retriesExhaustedLogLevel="ERROR"/>
You can use logName to use a custom logger instead of the default
<camel:errorHandler id="myErrorHandler" type="DeadLetterChannel"
useOriginalBody="true"
logName="xxxx"
deadLetterUri="jms:queue:mybackoutq">
On Tue, Dec 27, 2022 at 11:35 AM Burcu Egri
<[email protected]> wrote:
> After some investigation in Apache-Camel sources, we see that parser do
> not parse log line in errorHandler section (see
> https://github.com/apache/camel/blob/main/components/camel-spring-xml/src/main/java/org/apache/camel/spring/xml/handler/ErrorHandlerDefinitionParser.java#L77]
> ).
>
> It seems it is a bug.
>
> Are there anybody to confirm this bug?
>
> -----Original Message-----
> From: Burcu Egri <[email protected]>
> Sent: Tuesday, December 27, 2022 12:28 AM
> To: [email protected]
> Subject: Camel errorHandler doesn't log before or after sending message to
> the dead letter channel
>
> CAUTION: This email originated from outside of the organisation. Do not
> click links or open attachments unless you recognise the sender and know
> the content is safe.
>
>
> We have a simple Camel route like below. But we have noticed that
> errorHandler log is not working. After some investigation, we understood
> that errorHandler has different log parameters then other logs(like in
> route or onException).
>
> We haven't succeeded to use errorHandler log. Yes, there are so many
> options to log but we want to learn how to use this one. Our aim is to log
> some texts before or after sending messages to deadletter queue.
> How can we use errorHandler log?
>
> apache-camel : 3.19.0
>
> spring-boot : 2.7.5
>
> <beans xmlns="
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mcEL%2FAmmypcVTuvESFoBKB%2Bsh0xRtLfnBpstgH0ZNZk%3D&reserved=0
> "
> xmlns:xsi="
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ig%2BO8ATt3gbPUR%2BS9wjJ1R5qeiCn46wnIlmGYO53kEM%3D&reserved=0
> "
> xmlns:camel="
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fqaeo%2FrYRZDZA9b%2FdJcND6pdx3jZ2tRbhtgeXHQZ5gI%3D&reserved=0
> "
> xsi:schemaLocation="
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mcEL%2FAmmypcVTuvESFoBKB%2Bsh0xRtLfnBpstgH0ZNZk%3D&reserved=0
>
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.springframework.org%2Fschema%2Fbeans%2Fspring-beans.xsd&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=16XOnDlOBIOM4jWjzcaHOB%2FIKErU2SwiDKFBoMf5Zyw%3D&reserved=0
>
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fqaeo%2FrYRZDZA9b%2FdJcND6pdx3jZ2tRbhtgeXHQZ5gI%3D&reserved=0
>
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring%2Fcamel-spring.xsd&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=12zfs2SS%2Fjeikf9EGejV4T3ygjxq11LpzGXnz9auWV8%3D&reserved=0
> ">
>
> <bean id="mdcEnricher" class="com.mycompany.MDCEnricher"/>
>
> <camel:camelContext id="mycontext" xmlns="
> https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel.apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cf0159ba352564a92008608dae7880d02%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638076869017462349%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fqaeo%2FrYRZDZA9b%2FdJcND6pdx3jZ2tRbhtgeXHQZ5gI%3D&reserved=0"
> useMDCLogging="true">
>
> <camel:errorHandler id="myErrorHandler" type="DeadLetterChannel"
> useOriginalBody="true"
> deadLetterUri="jms:queue:mybackoutq">
> <redeliveryPolicy
> maximumRedeliveries="1"
> redeliveryDelay="1"
> retryAttemptedLogLevel="WARN"
> retriesExhaustedLogLevel="ERROR"/>
> <log id="logIncomingMsg" logName="com.mypackage"
> loggingLevel="ERROR" message="Pushing to backout queue"/>
> </camel:errorHandler>
>
>
> <camel:route id="myRoute" errorHandlerRef="myErrorHandler">
> <from uri="jms:queue:myinputq"/>
> <bean ref="mdcEnricher" method="enrich"/>
> <log message="Received exchange with message id:
> [${headers.JMSMessageID}], starting processing"/>
> <process ref="#class:com.mycompany.processor.MyProcessor"/>
> <to uri="jms:queue:myoutputq"/>
> <log message="Finished the processing exchange with message
> id: [${headers.JMSMessageID}]"/>
> </camel:route>
>
> Try to change log configuration and loggingLevel to DEBUG but nothing
> changed.
>
> <springProfile name="local">
> <logger name="org.apache.camel" level="DEBUG"/>
> <logger name="com.mycompany" level="DEBUG"/>
> <root level="DEBUG">
> <appender-ref ref="LocalConsole"/>
> </root>
> </springProfile>
>
--
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
