Hi Matthias,

use the logging module rt/features/logging instead

On 3/30/21, Matthias Tonhäuser <[email protected]> wrote:
> Hi there,
>
> I’m trying to add logging to my Apache CXF 3.4.3 client. I would like to
> enable pretty printing and mask sensitive information like the user name and
> the password.
>
> This is what Apache CXF recommends for enabling logging:
>
> <beans xmlns="http://www.springframework.org/schema/beans";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:cxf="http://cxf.apache.org/core";
>       xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus>
> </beans>
>
> However, I don’t know how to enable pretty printing there. Therefore I came
> up with this solution:
>
> <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xmlns:cxf="http://cxf.apache.org/core";
>        xsi:schemaLocation="
> http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>
>   <bean id="logInbound"
> class="org.apache.cxf.interceptor.LoggingInInterceptor">
>    <property name="prettyLogging" value="true"/>
>   </bean>
>   <bean id="logOutbound"
> class="org.apache.cxf.interceptor.LoggingOutInterceptor">
>     <property name="prettyLogging" value="true"/>
>   </bean>
>
>   <cxf:bus>
>     <cxf:inInterceptors>
>       <ref bean="logInbound"/>
>     </cxf:inInterceptors>
>     <cxf:outInterceptors>
>       <ref bean="logOutbound"/>
>     </cxf:outInterceptors>
>     <cxf:outFaultInterceptors>
>       <ref bean="logOutbound"/>
>     </cxf:outFaultInterceptors>
>     <cxf:inFaultInterceptors>
>       <ref bean="logInbound"/>
>     </cxf:inFaultInterceptors>
>   </cxf:bus>
> </beans>
>
>
> However, the LoggingInInterceptor and its counterpart are marked as
> deprecated. Is there are a better way to do this?
>
> I would like to mask sensitive information in the logging statements as
> well.
>
> This site here (https://cxf.apache.org/docs/message-logging.html) says that
> LoggingFeature has two new methods as of version 3.4.0:
>
> addSensitiveElementNames(final Set<String> sensitiveElements); Configures
> names of sensitive XML and JSON elements, values to be masked.
> addSensitiveProtocolHeaderNames(final Set<String> sensitiveProtocolHeaders);
> Configures names of sensitive protocol headers, values to be masked.
>
> I took a look at org.apache.cxf.feature.LoggingFeature in 3.4.3 but could
> not find any of these methods. Am I doing something wrong or haven’t the
> methods been added yet?
>
> Thanks!
>
> Kind regards
>
> Matthias
> _________________________________________________________________________
>
> [cid:[email protected]]
>
> Matthias Tonhäuser  | Softwareentwickler
> Fon 0251 9159-501
>
> GuideCom AG | Hafenweg 14 | 48155 Münster |
> www.guidecom.de<http://www.guidecom.de/> | Amtsgericht Münster HRB 18577
> Vorstand: Robin Wunsch (Sprecher), Mathias Bokelmann, Günter Meyer, Dr.
> Michael Thygs
> Aufsichtsrat: Robert Baresel (Vorsitzender), Prof. Dr. Margret Borchert,
> Prof. Dr. Jan Recker
> _________________________________________________________________________
>
> How tomorrow works.
>
>

Reply via email to