You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nishant Chandra <ni...@gmail.com> on 2012/02/09 10:36:10 UTC

Log API time

Hi,

I was wondering if it is possible to log request processing time i.e. start
and end time using CXF interceptor?

Thanks,
Nishant

Re: Log API time

Posted by Shakeel Shaik <sh...@gmail.com>.
As Surgey suggested, have two pairs of interceptors one at receive phase
and another at Send Phase. Have ThreadLocal in Receiver phase and retrieve
it in Send phase or at any other place you want.


Thanks,
Shak



On Thu, Feb 9, 2012 at 5:55 AM, Stas Ostapenko <st...@gmail.com>wrote:

> If you are using Spring it's can be implemented using AOP - around
> advice. Pointcut on methods of your endpoint interface.
>
> BR,
> Stas
>
> On Thu, Feb 9, 2012 at 1:48 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
> > On 09/02/12 11:34, Nishant Chandra wrote:
> >>
> >> Thanks. I was looking for a context to store and retrieve a value. I
> hope
> >> there will be no side effects in storing data using setExchange()?
> >>
> > Exchange is scoped by a given request only
> >
> > Cheers, Sergey
> >
> >
> >> Thanks,
> >> Nishant
> >>
> >> On Thu, Feb 9, 2012 at 4:26 PM, Sergey
> >> Beryozkin<sb...@gmail.com>wrote:
> >>
> >>> On 09/02/12 10:10, Nishant Chandra wrote:
> >>>
> >>>> I agree. But I am more interested in time spent inside CXF.
> >>>>
> >>>>
> >>> Typically you can do it in CXF by using a pair of interceptors.
> >>> The CXF in interceptor will save the current time on the Exchange
> >>> (message.getExchange()) and then retrieve this value in the out
> >>> interceptors, or vice-versa if it's done on the client side
> >>>
> >>> HTH
> >>> Sergey
> >>>
> >>>
> >>>  Nishant
> >>>>
> >>>>
> >>>> On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland<jens.borgland@gmail.com
> >>>>>
> >>>>> wrote:
> >>>>
> >>>>
> >>>>  Hi,
> >>>>>
> >>>>>
> >>>>> I think that could much easier be handled with a servlet filter
> >>>>> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
> >>>>>
> >>>>> Jens
> >>>>>
> >>>>> 2012/2/9 Nishant Chandra<ni...@gmail.com>:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I was wondering if it is possible to log request processing time
> i.e.
> >>>>>>
> >>>>> start
> >>>>>
> >>>>>> and end time using CXF interceptor?
> >>>>>>
> >>>>>> Thanks,
> >>>>>> Nishant
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>> --
> >>> Sergey Beryozkin
> >>>
> >>> Talend Community Coders
> >>> http://coders.talend.com/
> >>>
> >>> Blog: http://sberyozkin.blogspot.com
> >>>
> >>
> >>
> >>
> >
> >
> > --
> > Sergey Beryozkin
> >
> > Talend Community Coders
> > http://coders.talend.com/
> >
> > Blog: http://sberyozkin.blogspot.com
>

Re: Log API time

Posted by Stas Ostapenko <st...@gmail.com>.
If you are using Spring it's can be implemented using AOP - around
advice. Pointcut on methods of your endpoint interface.

BR,
Stas

On Thu, Feb 9, 2012 at 1:48 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> On 09/02/12 11:34, Nishant Chandra wrote:
>>
>> Thanks. I was looking for a context to store and retrieve a value. I hope
>> there will be no side effects in storing data using setExchange()?
>>
> Exchange is scoped by a given request only
>
> Cheers, Sergey
>
>
>> Thanks,
>> Nishant
>>
>> On Thu, Feb 9, 2012 at 4:26 PM, Sergey
>> Beryozkin<sb...@gmail.com>wrote:
>>
>>> On 09/02/12 10:10, Nishant Chandra wrote:
>>>
>>>> I agree. But I am more interested in time spent inside CXF.
>>>>
>>>>
>>> Typically you can do it in CXF by using a pair of interceptors.
>>> The CXF in interceptor will save the current time on the Exchange
>>> (message.getExchange()) and then retrieve this value in the out
>>> interceptors, or vice-versa if it's done on the client side
>>>
>>> HTH
>>> Sergey
>>>
>>>
>>>  Nishant
>>>>
>>>>
>>>> On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland<jens.borgland@gmail.com
>>>>>
>>>>> wrote:
>>>>
>>>>
>>>>  Hi,
>>>>>
>>>>>
>>>>> I think that could much easier be handled with a servlet filter
>>>>> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
>>>>>
>>>>> Jens
>>>>>
>>>>> 2012/2/9 Nishant Chandra<ni...@gmail.com>:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I was wondering if it is possible to log request processing time i.e.
>>>>>>
>>>>> start
>>>>>
>>>>>> and end time using CXF interceptor?
>>>>>>
>>>>>> Thanks,
>>>>>> Nishant
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>>>
>>
>>
>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com

Re: Log API time

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 09/02/12 11:34, Nishant Chandra wrote:
> Thanks. I was looking for a context to store and retrieve a value. I hope
> there will be no side effects in storing data using setExchange()?
>
Exchange is scoped by a given request only

Cheers, Sergey

> Thanks,
> Nishant
>
> On Thu, Feb 9, 2012 at 4:26 PM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> On 09/02/12 10:10, Nishant Chandra wrote:
>>
>>> I agree. But I am more interested in time spent inside CXF.
>>>
>>>
>> Typically you can do it in CXF by using a pair of interceptors.
>> The CXF in interceptor will save the current time on the Exchange
>> (message.getExchange()) and then retrieve this value in the out
>> interceptors, or vice-versa if it's done on the client side
>>
>> HTH
>> Sergey
>>
>>
>>   Nishant
>>>
>>> On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland<jens.borgland@gmail.com
>>>> wrote:
>>>
>>>   Hi,
>>>>
>>>> I think that could much easier be handled with a servlet filter
>>>> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
>>>>
>>>> Jens
>>>>
>>>> 2012/2/9 Nishant Chandra<ni...@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I was wondering if it is possible to log request processing time i.e.
>>>>>
>>>> start
>>>>
>>>>> and end time using CXF interceptor?
>>>>>
>>>>> Thanks,
>>>>> Nishant
>>>>>
>>>>
>>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Log API time

Posted by Nishant Chandra <ni...@gmail.com>.
Thanks. I was looking for a context to store and retrieve a value. I hope
there will be no side effects in storing data using setExchange()?

Thanks,
Nishant

On Thu, Feb 9, 2012 at 4:26 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> On 09/02/12 10:10, Nishant Chandra wrote:
>
>> I agree. But I am more interested in time spent inside CXF.
>>
>>
> Typically you can do it in CXF by using a pair of interceptors.
> The CXF in interceptor will save the current time on the Exchange
> (message.getExchange()) and then retrieve this value in the out
> interceptors, or vice-versa if it's done on the client side
>
> HTH
> Sergey
>
>
>  Nishant
>>
>> On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland<jens.borgland@gmail.com
>> >wrote:
>>
>>  Hi,
>>>
>>> I think that could much easier be handled with a servlet filter
>>> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
>>>
>>> Jens
>>>
>>> 2012/2/9 Nishant Chandra<ni...@gmail.com>:
>>>
>>>> Hi,
>>>>
>>>> I was wondering if it is possible to log request processing time i.e.
>>>>
>>> start
>>>
>>>> and end time using CXF interceptor?
>>>>
>>>> Thanks,
>>>> Nishant
>>>>
>>>
>>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>



-- 
Nishant Chandra
Bangalore, India
Cell : +91 9739131616

Re: Log API time

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 09/02/12 10:10, Nishant Chandra wrote:
> I agree. But I am more interested in time spent inside CXF.
>

Typically you can do it in CXF by using a pair of interceptors.
The CXF in interceptor will save the current time on the Exchange 
(message.getExchange()) and then retrieve this value in the out 
interceptors, or vice-versa if it's done on the client side

HTH
Sergey

> Nishant
>
> On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland<je...@gmail.com>wrote:
>
>> Hi,
>>
>> I think that could much easier be handled with a servlet filter
>> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
>>
>> Jens
>>
>> 2012/2/9 Nishant Chandra<ni...@gmail.com>:
>>> Hi,
>>>
>>> I was wondering if it is possible to log request processing time i.e.
>> start
>>> and end time using CXF interceptor?
>>>
>>> Thanks,
>>> Nishant
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Log API time

Posted by Nishant Chandra <ni...@gmail.com>.
I agree. But I am more interested in time spent inside CXF.

Nishant

On Thu, Feb 9, 2012 at 3:10 PM, Jens Borgland <je...@gmail.com>wrote:

> Hi,
>
> I think that could much easier be handled with a servlet filter
> (http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).
>
> Jens
>
> 2012/2/9 Nishant Chandra <ni...@gmail.com>:
> > Hi,
> >
> > I was wondering if it is possible to log request processing time i.e.
> start
> > and end time using CXF interceptor?
> >
> > Thanks,
> > Nishant
>

Re: Log API time

Posted by Jens Borgland <je...@gmail.com>.
Hi,

I think that could much easier be handled with a servlet filter
(http://docs.oracle.com/javaee/6/api/javax/servlet/Filter.html).

Jens

2012/2/9 Nishant Chandra <ni...@gmail.com>:
> Hi,
>
> I was wondering if it is possible to log request processing time i.e. start
> and end time using CXF interceptor?
>
> Thanks,
> Nishant

Re: Log API time

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday, February 09, 2012 3:06:10 PM Nishant Chandra wrote:
> Hi,
> 
> I was wondering if it is possible to log request processing time i.e. start
> and end time using CXF interceptor?

There is some support for this built into the CXF management module.  See the 
bottom of:

http://cxf.apache.org/docs/jmx-management.html



-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com