You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ebinsingh <eb...@VerizonWireless.com> on 2012/01/19 19:44:30 UTC

Issue with logging

Hi All,

For some reason I am not able to see any of the logs defined in the below
route.
Appreciate your help in solving this.

Noticed that if I removed the choice from the second route, all the logging
appears in my log file.
I need to find out which choice loop is executed.


<endpoint id="acquireltel2"
uri="file:C:/camelProject/data/inbox?move=C:/camelProject/data/inbox/bkp" />
<endpoint id="producerQueue" uri="direct:producerQueue"/>
<endpoint id="dispatchltel2" uri="direct:dispatchltel2" />

<route>
	<from ref="acquireltel2" />
		<setHeader headerName="pathName">
			<simple>${file:path}</simple>
		</setHeader>
		<setHeader headerName="fileName">
			<simple>${file:name}</simple>
		</setHeader>
		<setHeader headerName="fileType">
			<constant>ltel2</constant>
		</setHeader>
		<log message="set header pathName to ${file:path}" loggingLevel="INFO"/>
		<log message="set header fileName to ${file:name}" loggingLevel="INFO"/>
		<log message="set header fileType to ltel2 ${header.fileType}"
loggingLevel="INFO"/>
	<to ref="producerQueue"/>
</route>

<route>
	<from ref="producerQueue"/>
	<log message="set header fileType to ltel2 ${header.fileType}"
loggingLevel="INFO"/>
	<choice>
		<when>
			<simple>${header.fileType} == "ltel2"</simple>
			<log message="processing ltel2 file type" loggingLevel="INFO" />
			<threads executorServiceRef="ltel2threadpool1">
				<bean ref="ltel2Consumer" method="doConsume" />
			</threads>
		</when>
		<when>
			<simple>${header.fileType} == "ltel3"</simple>
			<log message="processing ltel3 file type" loggingLevel="INFO" />
		</when>
	</choice>
</route>

Thanks & regards,
Ebe

--
View this message in context: http://camel.465427.n5.nabble.com/Issue-with-logging-tp5158558p5158558.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue with logging

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You have 2 when in the choice, which means if both when is false, then
it will pick otherwise. But you do not have that. So you will not see
anything.

Add an <otherwise> to have a log in case any of the when fails.

And the simple expression in Camel 2.8.x or earlier you must be a bit
more exact when using operators.
Camel 2.9 has a better syntax validator
http://davsclaus.blogspot.com/2011/09/camel-29-much-improved-simple-language.html







On Thu, Jan 19, 2012 at 7:44 PM, ebinsingh
<eb...@verizonwireless.com> wrote:
> Hi All,
>
> For some reason I am not able to see any of the logs defined in the below
> route.
> Appreciate your help in solving this.
>
> Noticed that if I removed the choice from the second route, all the logging
> appears in my log file.
> I need to find out which choice loop is executed.
>
>
> <endpoint id="acquireltel2"
> uri="file:C:/camelProject/data/inbox?move=C:/camelProject/data/inbox/bkp" />
> <endpoint id="producerQueue" uri="direct:producerQueue"/>
> <endpoint id="dispatchltel2" uri="direct:dispatchltel2" />
>
> <route>
>        <from ref="acquireltel2" />
>                <setHeader headerName="pathName">
>                        <simple>${file:path}</simple>
>                </setHeader>
>                <setHeader headerName="fileName">
>                        <simple>${file:name}</simple>
>                </setHeader>
>                <setHeader headerName="fileType">
>                        <constant>ltel2</constant>
>                </setHeader>
>                <log message="set header pathName to ${file:path}" loggingLevel="INFO"/>
>                <log message="set header fileName to ${file:name}" loggingLevel="INFO"/>
>                <log message="set header fileType to ltel2 ${header.fileType}"
> loggingLevel="INFO"/>
>        <to ref="producerQueue"/>
> </route>
>
> <route>
>        <from ref="producerQueue"/>
>        <log message="set header fileType to ltel2 ${header.fileType}"
> loggingLevel="INFO"/>
>        <choice>
>                <when>
>                        <simple>${header.fileType} == "ltel2"</simple>
>                        <log message="processing ltel2 file type" loggingLevel="INFO" />
>                        <threads executorServiceRef="ltel2threadpool1">
>                                <bean ref="ltel2Consumer" method="doConsume" />
>                        </threads>
>                </when>
>                <when>
>                        <simple>${header.fileType} == "ltel3"</simple>
>                        <log message="processing ltel3 file type" loggingLevel="INFO" />
>                </when>
>        </choice>
> </route>
>
> Thanks & regards,
> Ebe
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Issue-with-logging-tp5158558p5158558.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/