Hi Just a caution that using camel-spring-xml with Spring XML is becoming legacy/deprecated. It is the very old XML DSL in Camel v1/v2.
So what you can do is to use a route as DLQ that uses direct where you can then do from direct myDLQ log bla blah to jms:dead And then configure the error handler to use direct myDLQ Then you can do anything you like in the route On Tue, Dec 27, 2022 at 12:58 PM Burcu Egri <burcu.e...@aerlingus.com.invalid> wrote: > Hi, > Thank you for your reply... > > Yes, I refer the <log> inside errorHandler. > Do you mean that > org.apache.camel.spring.xml.handler.ErrorHandlerDefinitionParser.doParse > should parse <log>? > > I checked your suggestions, but the first 2 parameters are related with > the redeliveryPolicy and our aim is to log just after errorHandler started. > In the future we are planning to remove redeliveryPolicy part... > > I tried to set logName attribute in errorHandler but I am getting below > error message. > > Caused by: org.springframework.beans.NotWritablePropertyException: Invalid > property 'logName' of bean class > [org.apache.camel.builder.LegacyDeadLetterChannelBuilder]: Bean property > 'logName' is not writable or has an invalid setter method. Does the > parameter type of the setter match the return type of the getter? > > In addition to this I tried to set name from Java inside > CamelContextConfiguration. beforeApplicationStart > camelContext.getGlobalOptions().put(Exchange.LOG_EIP_NAME, " com.mypackage > "); > > but I am not sure how to set message because <log> is not parsed in > errorHandler. We need to find a way to set log message. > > Do you have any other suggestion? > > Best regards, > Burcu > > -----Original Message----- > From: Claus Ibsen <claus.ib...@gmail.com> > Sent: Tuesday, December 27, 2022 1:44 PM > To: users@camel.apache.org > Subject: Re: 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. > > > 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 <burcu.e...@aerlingus.com.invalid> > wrote: > > > After some investigation in Apache-Camel sources, we see that parser > > do not parse log line in errorHandler section (see > > https://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith > > ub.com%2Fapache%2Fcamel%2Fblob%2Fmain%2Fcomponents%2Fcamel-spring-xml% > > 2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcamel%2Fspring%2Fxml%2Fhandler%2F > > ErrorHandlerDefinitionParser.java%23L77&data=05%7C01%7CBurcu.Egri%40ae > > rlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef > > 72b859bc5c0%7C0%7C0%7C638077346559845038%7CUnknown%7CTWFpbGZsb3d8eyJWI > > joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7 > > C%7C%7C&sdata=fIYP0Tn5BAOOBt26v3YSpMkTNcCHZs5QGDhYuuhPKXk%3D&reserved= > > 0] > > ). > > > > It seems it is a bug. > > > > Are there anybody to confirm this bug? > > > > -----Original Message----- > > From: Burcu Egri <burcu.e...@aerlingus.com.INVALID> > > Sent: Tuesday, December 27, 2022 12:28 AM > > To: users@camel.apache.org > > 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.s > > pringframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerlin > > gus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b8 > > 59bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM > > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C > > %7C&sdata=yGykqDG7w4AqrLqfXYQEYHvjypP1ptoIxkE30nHFY3Q%3D&reserved=0 > > " > > xmlns:xsi=" > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w > > 3.org%2F2001%2FXMLSchema-instance&data=05%7C01%7CBurcu.Egri%40aerlingu > > s.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859 > > bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 > > wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7 > > C&sdata=fi8vX7Ux0XJCExlRN%2F187r0zaVmZwNF1oMD6waMcoMw%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.co > > m%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc5c > > 0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sd > > ata=PpfTX%2BBYwEZIPEb41ld4f9Ot8GNN0sopA0czE2LBnHU%3D&reserved=0 > > " > > xsi:schemaLocation=" > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.s > > pringframework.org%2Fschema%2Fbeans&data=05%7C01%7CBurcu.Egri%40aerlin > > gus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b8 > > 59bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM > > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C > > %7C&sdata=yGykqDG7w4AqrLqfXYQEYHvjypP1ptoIxkE30nHFY3Q%3D&reserved=0 > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.s > > pringframework.org%2Fschema%2Fbeans%2Fspring-beans.xsd&data=05%7C01%7C > > Burcu.Egri%40aerlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf76 > > 36536c46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTW > > FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 > > Mn0%3D%7C3000%7C%7C%7C&sdata=DdZ3l1f%2BMP2WWWYX%2FmICXJaCeNHPhge4FRlUi > > 1A5w9w%3D&reserved=0 > > > > https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcamel > > .apache.org%2Fschema%2Fspring&data=05%7C01%7CBurcu.Egri%40aerlingus.co > > m%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc5c > > 0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sd > > ata=PpfTX%2BBYwEZIPEb41ld4f9Ot8GNN0sopA0czE2LBnHU%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%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c > > 46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZs > > b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D > > %7C3000%7C%7C%7C&sdata=7pQoV7gMmG%2FSHuCcL8VmuRuySIqJF90UbZiOiJjGaNw%3 > > D&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%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PpfTX%2BBYwEZIPEb41ld4f9Ot8GNN0sopA0czE2LBnHU%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://gbr01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.manning.com%2Fibsen2&data=05%7C01%7CBurcu.Egri%40aerlingus.com%7Cb2261550ed5f45abb72c08dae7f74c1b%7C57bf7636536c46bf9adef72b859bc5c0%7C0%7C0%7C638077346560001301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sS4pDSGzU18gYFXjkRlxMsPxMeZj%2BHwK6nhACBG9Svw%3D&reserved=0 > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2