You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Maslov <th...@gmail.com> on 2015/12/29 08:28:07 UTC

Log empty message (with HTTP status code only)

Hi!
I need to log imcoming requests with corresponsing responses.
According
I add custom LoggingFeature and implement LogEventSender interface.
The messages log fine except messages with emtpty body and
containing http status code only (these are the responses to the service).
According the contract, these messages are needed to be sent.
How could I log them?

-- 
*Sergey Maslov*

Re: Log empty message (with HTTP status code only)

Posted by Sergey Beryozkin <sb...@gmail.com>.
I'm not sure right now, perhaps Aki or Dan may have an idea.
May be you can register a custom Log interceptor, after 
LoggingInInterceptor, that will check CXF message if it is one way 
(there has to be some property set in the message) and log only if it is 
oneway...

Cheers, Sergey
On 29/12/15 18:00, Sergey Maslov wrote:
> Sergey, thank you.
> But how could I log the fact of 202 response?
>
> Segery Maslov
>
> On Tue, Dec 29, 2015 at 11:55 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> I think it might be because 202 is handled by a oneway processor and the
>> outbound chain is not invoked though I might be wrong...
>>
>> Sergey
>> On 29/12/15 11:17, Sergey Maslov wrote:
>>
>>> The issue is reproduced for with 202 - Accepted http status.
>>>
>>> On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <th...@gmail.com>
>>> wrote:
>>>
>>> Hi!
>>>> I need to log imcoming requests with corresponsing responses.
>>>> According
>>>> I add custom LoggingFeature and implement LogEventSender interface.
>>>> The messages log fine except messages with emtpty body and
>>>> containing http status code only (these are the responses to the
>>>> service).
>>>> According the contract, these messages are needed to be sent.
>>>> How could I log them?
>>>>
>>>> --
>>>> *Sergey Maslov*
>>>>
>>>>
>>>
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>
>
>


-- 
Sergey Beryozkin

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

RE: Log empty message (with HTTP status code only)

Posted by Andrei Shakirin <as...@talend.com>.
Hi Sergei,

As Sergey Beryozkin have written, in case of oneWay response will be sent already in inbound chain, exactly in OneWayProcessorInterceptor.
This interceptor gets the back channel Conduit and closes it:
                    message.getExchange().setInMessage(null);
                    //for a one-way, the back channel could be
                    //null if it knows it cannot send anything.
                    conduit.prepare(partial);
                    conduit.close(partial);

In this moment 202 response will be sent back to the client.
The 202 code is set in AbstractHTTPDestination.getReponseCodeFromMessage().

So outbound chain wouldn't built in this case.

The simple option to log the response:
Add your custom interceptor after OneWayProcessorInterceptor (pre-logical) and ServiceInvokerInterceptor (invoke). In this interceptor check oneWay exchange  message.getExchange().isOneWay() and log response code from inMessage:
message.getExchange().getInMessage().get("HTTP.RESPONSE") .

Regards,
Andrei.


> -----Original Message-----
> From: Sergey Maslov [mailto:therealmasel@gmail.com]
> Sent: Dienstag, 29. Dezember 2015 19:01
> To: users@cxf.apache.org
> Subject: Re: Log empty message (with HTTP status code only)
> 
> Sergey, thank you.
> But how could I log the fact of 202 response?
> 
> Segery Maslov
> 
> On Tue, Dec 29, 2015 at 11:55 PM, Sergey Beryozkin
> <sb...@gmail.com>
> wrote:
> 
> > I think it might be because 202 is handled by a oneway processor and
> > the outbound chain is not invoked though I might be wrong...
> >
> > Sergey
> > On 29/12/15 11:17, Sergey Maslov wrote:
> >
> >> The issue is reproduced for with 202 - Accepted http status.
> >>
> >> On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov
> >> <th...@gmail.com>
> >> wrote:
> >>
> >> Hi!
> >>> I need to log imcoming requests with corresponsing responses.
> >>> According
> >>> I add custom LoggingFeature and implement LogEventSender interface.
> >>> The messages log fine except messages with emtpty body and
> >>> containing http status code only (these are the responses to the
> >>> service).
> >>> According the contract, these messages are needed to be sent.
> >>> How could I log them?
> >>>
> >>> --
> >>> *Sergey Maslov*
> >>>
> >>>
> >>
> >>
> >>
> >
> > --
> > Sergey Beryozkin
> >
> > Talend Community Coders
> > http://coders.talend.com/
> >
> 
> 
> 
> --
> *Sergey Maslov*

Re: Log empty message (with HTTP status code only)

Posted by Sergey Maslov <th...@gmail.com>.
Sergey, thank you.
But how could I log the fact of 202 response?

Segery Maslov

On Tue, Dec 29, 2015 at 11:55 PM, Sergey Beryozkin <sb...@gmail.com>
wrote:

> I think it might be because 202 is handled by a oneway processor and the
> outbound chain is not invoked though I might be wrong...
>
> Sergey
> On 29/12/15 11:17, Sergey Maslov wrote:
>
>> The issue is reproduced for with 202 - Accepted http status.
>>
>> On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <th...@gmail.com>
>> wrote:
>>
>> Hi!
>>> I need to log imcoming requests with corresponsing responses.
>>> According
>>> I add custom LoggingFeature and implement LogEventSender interface.
>>> The messages log fine except messages with emtpty body and
>>> containing http status code only (these are the responses to the
>>> service).
>>> According the contract, these messages are needed to be sent.
>>> How could I log them?
>>>
>>> --
>>> *Sergey Maslov*
>>>
>>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>



-- 
*Sergey Maslov*

Re: Log empty message (with HTTP status code only)

Posted by Sergey Beryozkin <sb...@gmail.com>.
I think it might be because 202 is handled by a oneway processor and the 
outbound chain is not invoked though I might be wrong...

Sergey
On 29/12/15 11:17, Sergey Maslov wrote:
> The issue is reproduced for with 202 - Accepted http status.
>
> On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <th...@gmail.com>
> wrote:
>
>> Hi!
>> I need to log imcoming requests with corresponsing responses.
>> According
>> I add custom LoggingFeature and implement LogEventSender interface.
>> The messages log fine except messages with emtpty body and
>> containing http status code only (these are the responses to the service).
>> According the contract, these messages are needed to be sent.
>> How could I log them?
>>
>> --
>> *Sergey Maslov*
>>
>
>
>


-- 
Sergey Beryozkin

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

Re: Log empty message (with HTTP status code only)

Posted by Sergey Maslov <th...@gmail.com>.
The issue is reproduced for with 202 - Accepted http status.

On Tue, Dec 29, 2015 at 1:28 PM, Sergey Maslov <th...@gmail.com>
wrote:

> Hi!
> I need to log imcoming requests with corresponsing responses.
> According
> I add custom LoggingFeature and implement LogEventSender interface.
> The messages log fine except messages with emtpty body and
> containing http status code only (these are the responses to the service).
> According the contract, these messages are needed to be sent.
> How could I log them?
>
> --
> *Sergey Maslov*
>



-- 
*Sergey Maslov*