Outputting time to logs for route to process a message

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Outputting time to logs for route to process a message

gilboy
Hi

My route does some business processing - i.e. consumes messages from a topic, performs some business logic then sends message to a REST endpoint.

After sending the message to the REST endpoint I have 1 final log statement to state the route is complete for this particular message. I would like to also output in this log statement the time it took to complete the  processing of this message on this route.

I guess there are many ways but was wondering what the simplest and least invasive is

Thanks
Joe
Reply | Threaded
Open this post in threaded view
|

Re: Outputting time to logs for route to process a message

Claus Ibsen-2
Hi

There is a created timestamp on the exchange when it was created, so
you can access that and log.

Though we could also consider adding an easy to use function in simple
language to output it, so you can do:

.log("This message took ${elapsed} ms to process")




On Tue, Dec 8, 2015 at 9:51 AM, gilboy <[hidden email]> wrote:

> Hi
>
> My route does some business processing - i.e. consumes messages from a
> topic, performs some business logic then sends message to a REST endpoint.
>
> After sending the message to the REST endpoint I have 1 final log statement
> to state the route is complete for this particular message. I would like to
> also output in this log statement the time it took to complete the
> processing of this message on this route.
>
> I guess there are many ways but was wondering what the simplest and least
> invasive is
>
> Thanks
> Joe
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Outputting-time-to-logs-for-route-to-process-a-message-tp5774815.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2