You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cheng <ch...@gmail.com> on 2015/10/04 12:07:49 UTC

can logging and StaxTransformFeature use at the same time?

I found out that if I use both logging and StaxTransformFeature at the
same time, logging will not be performed. If I comment out
"transformFeature" in "features", logging works again

How can they work together? I am using cxf-2.4.2


<bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
        <property name="outTransformElements">
            <map>
                <entry key="{myapi}*" value="{myapi.API}*"/>
            </map>
        </property>
        <property name="inTransformElements">
            <map>
                <entry key="{myapi.API}*" value="{myapi}*"/>
            </map>
        </property>
    </bean>

    <bean id="fastinfoset" class="org.apache.cxf.feature.FastInfosetFeature"/>

    <bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
            <ref bean="transformFeature"/>
        </cxf:features>
        <cxf:outInterceptors>
            <ref bean="logOutbound"/>
        </cxf:outInterceptors>
        <cxf:inInterceptors>
            <ref bean="logInbound"/>
        </cxf:inInterceptors>
    </cxf:bus>

Re: can logging and StaxTransformFeature use at the same time?

Posted by Aki Yoshida <el...@gmail.com>.
If you are really using cxf-2.4.2, that is really too old and that
might be the reason why it is not working.

I don't know if there was some issue with 2.4.2. One thing to note in
your configuration is that you shouldn't be configuring logging using
both the logging feature and the logging interceptors at the same
time. Please remote the logging interceptors. If that is not changing
the behavior in 2.4.2, please try a more recent 2.7.x or 3.0.x. etc.

In any case, Logging and TransformFeature shouldn't be interfering
each other by default, so you don't need to do anything special with
them.

regards, aki

2015-10-16 2:48 GMT+02:00 Christopher Cheng <ch...@gmail.com>:
> It looks like that the transformation has to be executed in
> POST_STREAM, I am not sure what phase LOGGING is running in which
> phase
>
> On Mon, Oct 5, 2015 at 1:22 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
>> Some info is here
>> http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Transforminterceptorsandphases
>>
>> but it is not enough...
>> Sergey
>>
>> On 04/10/15 19:20, Sergey Beryozkin wrote:
>>>
>>> As far as I recall you can register TransformIn/OutInterceptor directly
>>> and set a phase on it to make sure it is run before Logging interceptors.
>>> Aki, can you please remind what the approach is, I recall you were
>>> fixing this issue :-)
>>> Thanks, Sergey
>>>
>>> On 04/10/15 12:07, Christopher Cheng wrote:
>>>>
>>>> I found out that if I use both logging and StaxTransformFeature at the
>>>> same time, logging will not be performed. If I comment out
>>>> "transformFeature" in "features", logging works again
>>>>
>>>> How can they work together? I am using cxf-2.4.2
>>>>
>>>>
>>>> <bean id="transformFeature"
>>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>>          <property name="outTransformElements">
>>>>              <map>
>>>>                  <entry key="{myapi}*" value="{myapi.API}*"/>
>>>>              </map>
>>>>          </property>
>>>>          <property name="inTransformElements">
>>>>              <map>
>>>>                  <entry key="{myapi.API}*" value="{myapi}*"/>
>>>>              </map>
>>>>          </property>
>>>>      </bean>
>>>>
>>>>      <bean id="fastinfoset"
>>>> class="org.apache.cxf.feature.FastInfosetFeature"/>
>>>>
>>>>      <bean id="logInbound"
>>>> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>>>      <bean id="logOutbound"
>>>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>>>
>>>>      <cxf:bus>
>>>>          <cxf:features>
>>>>              <cxf:logging/>
>>>>              <ref bean="transformFeature"/>
>>>>          </cxf:features>
>>>>          <cxf:outInterceptors>
>>>>              <ref bean="logOutbound"/>
>>>>          </cxf:outInterceptors>
>>>>          <cxf:inInterceptors>
>>>>              <ref bean="logInbound"/>
>>>>          </cxf:inInterceptors>
>>>>      </cxf:bus>
>>>>
>>>
>>>
>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/

Re: can logging and StaxTransformFeature use at the same time?

Posted by Christopher Cheng <ch...@gmail.com>.
It looks like that the transformation has to be executed in
POST_STREAM, I am not sure what phase LOGGING is running in which
phase

On Mon, Oct 5, 2015 at 1:22 AM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Some info is here
> http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Transforminterceptorsandphases
>
> but it is not enough...
> Sergey
>
> On 04/10/15 19:20, Sergey Beryozkin wrote:
>>
>> As far as I recall you can register TransformIn/OutInterceptor directly
>> and set a phase on it to make sure it is run before Logging interceptors.
>> Aki, can you please remind what the approach is, I recall you were
>> fixing this issue :-)
>> Thanks, Sergey
>>
>> On 04/10/15 12:07, Christopher Cheng wrote:
>>>
>>> I found out that if I use both logging and StaxTransformFeature at the
>>> same time, logging will not be performed. If I comment out
>>> "transformFeature" in "features", logging works again
>>>
>>> How can they work together? I am using cxf-2.4.2
>>>
>>>
>>> <bean id="transformFeature"
>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>          <property name="outTransformElements">
>>>              <map>
>>>                  <entry key="{myapi}*" value="{myapi.API}*"/>
>>>              </map>
>>>          </property>
>>>          <property name="inTransformElements">
>>>              <map>
>>>                  <entry key="{myapi.API}*" value="{myapi}*"/>
>>>              </map>
>>>          </property>
>>>      </bean>
>>>
>>>      <bean id="fastinfoset"
>>> class="org.apache.cxf.feature.FastInfosetFeature"/>
>>>
>>>      <bean id="logInbound"
>>> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>>      <bean id="logOutbound"
>>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>>
>>>      <cxf:bus>
>>>          <cxf:features>
>>>              <cxf:logging/>
>>>              <ref bean="transformFeature"/>
>>>          </cxf:features>
>>>          <cxf:outInterceptors>
>>>              <ref bean="logOutbound"/>
>>>          </cxf:outInterceptors>
>>>          <cxf:inInterceptors>
>>>              <ref bean="logInbound"/>
>>>          </cxf:inInterceptors>
>>>      </cxf:bus>
>>>
>>
>>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/

Re: can logging and StaxTransformFeature use at the same time?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Some info is here
http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Transforminterceptorsandphases

but it is not enough...
Sergey
On 04/10/15 19:20, Sergey Beryozkin wrote:
> As far as I recall you can register TransformIn/OutInterceptor directly
> and set a phase on it to make sure it is run before Logging interceptors.
> Aki, can you please remind what the approach is, I recall you were
> fixing this issue :-)
> Thanks, Sergey
>
> On 04/10/15 12:07, Christopher Cheng wrote:
>> I found out that if I use both logging and StaxTransformFeature at the
>> same time, logging will not be performed. If I comment out
>> "transformFeature" in "features", logging works again
>>
>> How can they work together? I am using cxf-2.4.2
>>
>>
>> <bean id="transformFeature"
>> class="org.apache.cxf.feature.StaxTransformFeature">
>>          <property name="outTransformElements">
>>              <map>
>>                  <entry key="{myapi}*" value="{myapi.API}*"/>
>>              </map>
>>          </property>
>>          <property name="inTransformElements">
>>              <map>
>>                  <entry key="{myapi.API}*" value="{myapi}*"/>
>>              </map>
>>          </property>
>>      </bean>
>>
>>      <bean id="fastinfoset"
>> class="org.apache.cxf.feature.FastInfosetFeature"/>
>>
>>      <bean id="logInbound"
>> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>>      <bean id="logOutbound"
>> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>>
>>      <cxf:bus>
>>          <cxf:features>
>>              <cxf:logging/>
>>              <ref bean="transformFeature"/>
>>          </cxf:features>
>>          <cxf:outInterceptors>
>>              <ref bean="logOutbound"/>
>>          </cxf:outInterceptors>
>>          <cxf:inInterceptors>
>>              <ref bean="logInbound"/>
>>          </cxf:inInterceptors>
>>      </cxf:bus>
>>
>
>


-- 
Sergey Beryozkin

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

Re: can logging and StaxTransformFeature use at the same time?

Posted by Sergey Beryozkin <sb...@gmail.com>.
As far as I recall you can register TransformIn/OutInterceptor directly 
and set a phase on it to make sure it is run before Logging interceptors.
Aki, can you please remind what the approach is, I recall you were 
fixing this issue :-)
Thanks, Sergey

On 04/10/15 12:07, Christopher Cheng wrote:
> I found out that if I use both logging and StaxTransformFeature at the
> same time, logging will not be performed. If I comment out
> "transformFeature" in "features", logging works again
>
> How can they work together? I am using cxf-2.4.2
>
>
> <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
>          <property name="outTransformElements">
>              <map>
>                  <entry key="{myapi}*" value="{myapi.API}*"/>
>              </map>
>          </property>
>          <property name="inTransformElements">
>              <map>
>                  <entry key="{myapi.API}*" value="{myapi}*"/>
>              </map>
>          </property>
>      </bean>
>
>      <bean id="fastinfoset" class="org.apache.cxf.feature.FastInfosetFeature"/>
>
>      <bean id="logInbound"
> class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
>      <bean id="logOutbound"
> class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
>
>      <cxf:bus>
>          <cxf:features>
>              <cxf:logging/>
>              <ref bean="transformFeature"/>
>          </cxf:features>
>          <cxf:outInterceptors>
>              <ref bean="logOutbound"/>
>          </cxf:outInterceptors>
>          <cxf:inInterceptors>
>              <ref bean="logInbound"/>
>          </cxf:inInterceptors>
>      </cxf:bus>
>


-- 
Sergey Beryozkin

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