Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6779293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:22:06+00:00 2026-05-26T16:22:06+00:00

I am using the Apache CXF Framework. Inside my client program, I need to

  • 0

I am using the Apache CXF Framework.
Inside my client program, I need to log CXF SOAP Requests and SOAP Responses.
When I used

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress(host);
factory.setServiceClass(MyService.class);
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());

I got these SOAP Request and SOAP Responses in the console:

Nov 9, 2011 6:48:01 PM org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
ID: 2
Encoding: UTF-8
Content-Type: text/xml
Headers: {}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns4:MYResponse
--------------------------------------

But my actual requirement is, instead of printing them to the server console, I need to have them inside the log file.

When I used log4j directly as shown

log4j(factory.getInInterceptors().add(new LoggingInInterceptor()));
log4j(factory.getOutInterceptors().add(new LoggingOutInterceptor()));

It is only printing true and true inside the log file.

Could anybody please let me know how to configure this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:22:06+00:00Added an answer on May 26, 2026 at 4:22 pm

    You need to create a file named org.apache.cxf.Logger (that is: org.apache.cxf file with Logger extension) under /META-INF/cxf/ with the following contents:

    org.apache.cxf.common.logging.Log4jLogger
    

    Reference: Using Log4j Instead of java.util.logging.

    Also if you replace standard:

    <cxf:bus>
      <cxf:features>
        <cxf:logging/>
      </cxf:features>
    </cxf:bus>
    

    with much more verbose:

    <bean id="abstractLoggingInterceptor" abstract="true">
        <property name="prettyLogging" value="true"/>
    </bean>
    <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" parent="abstractLoggingInterceptor"/>
    <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" parent="abstractLoggingInterceptor"/>
    
    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="loggingInInterceptor"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="loggingOutInterceptor"/>
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="loggingOutInterceptor"/>
        </cxf:outFaultInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="loggingInInterceptor"/>
        </cxf:inFaultInterceptors>
    </cxf:bus>
    

    Apache CXF will pretty print XML messages formatting them with proper indentation and line breaks. Very useful. More about it here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm now using Apache CXF as a web services client for a .NET service
We're using apache cxf 2.2.2 with JaxB and I need to change the wsdl:definitions
I have an application using Apache CXF with a lots of SOAP services implemented.
We have to create a web service client using Apache CXF in Java. The
I am using Apache CXF to connect to a SOAP API. I've saved the
I'm using CXF for web services. Because of some client restrictions, I need all
I'm deploying a SOAP webservice using Apache CXF on different servers. The WSDL contains
I am using apache CXF for the first time. I am trying to establish
I'm using Apache CXF's wsdl2java utility to create some JAXB objects and some web
I have developed a webservice using Apache CXF ,which will be in production very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.