Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display

 

Table of Contents

Configuring logging levels

In the /etc folder of the CXF distribution there is a sample Java SE logging.properties file you can use to configure logging. For example, if you want to change the console logging level from WARNING to FINE, you need to update two properties in this logging.properties file as below:

...

.level= FINE
java.util.logging.ConsoleHandler.level = FINE

Once this is done, you will need to set the -Djava.util.logging.config.file property to the location of the logging.properties file. As an example, the Ant target below has this property set:

...

<target name="runClient">
   <java classname="client.WSClient" fork="true">	    	
      <classpath>
         <pathelement location="${build.classes.dir}"/>
         <fileset dir="${env.CXF_HOME}/lib">
            <include name="*.jar"/>
         </fileset>
      </classpath>
      <jvmarg value="-Djava.util.logging.config.file=/usr/myclientapp/logging.properties"/>
   </java>
</target>

Alternatively, for SOAP clients, you can modify the Java-wide logging.properties file in the JDK_HOME/jre/lib folder, or for servlet-hosted web service providers, placing a logging.properties file in the WEB-INF/classes folder (see here for more details.)

Using Log4j Instead of java.util.logging

As noted above, CXF uses the java.util.logging package ("Java SE Logging") by default. But it is possible to switch CXF to instead use Log4J. This is achieved through the use of configuration files. There are two options to bootstrapping CXF logging and each is listed below:

  • Add the following system property to the classpath from which CXF is initialized:
Code Block
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger
  • Add the file META-INF/cxf/org.apache.cxf.Logger to the classpath and make sure it contains the following content:
Code Block
org.apache.cxf.common.logging.Log4jLogger

Using SLF4J Instead of java.util.logging (since 2.2.8)

As noted above, CXF uses the java.util.logging package by default. But it is possible to switch CXF to instead use SLF4J. This is achieved through the use of configuration files. There are two options to bootstrapping CXF logging and each is listed below:

  • Add the following system property to the classpath from which CXF is initialized:
Code Block
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger
  • Add the file META-INF/cxf/org.apache.cxf.Logger to the classpath and make sure it contains the following content:
Code Block
org.apache.cxf.common.logging.Slf4jLogger

Debugging Tools

Eclipse IDE

...

NetBeans include a debugger, profiler, profiler and an HTTP monitor that can assist in troubleshooting SOA applications.

...

tcpmonplus

tcpmon tcpmonplus allows you to easily view messages as they go back and forth on the wire. The companion utility tcptrace can be used for analysis of the dump.

WSMonitor

WSMonitor in another option to Tcpmon with slightly more functionality.

...

Wireshark, a network packet analyzer, is useful for following the routing of SOAP messages. It can also help when you are getting an HTML error message from the server that your CXF client cannot normally process, by allowing you to see the non-SOAP error message. See this blog entry for more information.

SOAP UI

SOAP UI can also be used for debugging. In addition to viewing messages, it allows you send messages and load test your services. It also has plugins for the Eclipse IDE, NetBeans IDE and IntelliJ IDEA.

...

WSDL Viewer is a small tool to visualize web-services in a more intuitive way.

SOAP Fault for debugging

...

Stack trace in fault details

...