Instructions for setting up remote logging in CXF using mDNS/Chainsaw
This will let you connect to a CXF container running on your local subnet and view incoming and outgoing messages to services
Set up Logging in the service
- Ensure that your classpath service includes: (both available from here: https://alis.cs.bath.ac.uk/svn/alive-code/alive-common-deps/trunk/log4j/
- In your web service classpath (e.g. webroot/WEB-INF/classes) create a file META-INF/cxf/org.apache.cxf.Logger and put the following into it:
- If you don't already have a log4j.properties file in your service classpath create one.
- Add an mDNS logger to your log4j.properties as follows:
- The port log4j.appender.zeroconf.port MUST be unique on the local machine - that is the port the log aggregator will listen on. It can be set to anything you like.
- In your service beans xml file add a logging interceptor:
- deploy and start the service
Set up the logging monitor
- download Chainsaw 2.0
- Open chainsaw (I had a problem with the HTML display and the tooltip window being weird) - this must be running on the same subnet as the service
- Click on the ZeroConf tab, you should see the logging service defined above.
- Double click on the zeroconf entry and connect
- Nothing will be displayed until you have some log messages
- When the service has been invoked you can drill-down on the specific interceptor logs by selecting the org/apache/cxf/interceptor branch, right clicking and selecting "Focus on org.apache.cxf.interceptor"
- You should then see live incoming and outgoing messages
I don't think the MDNS logger likes to be reloaded so you might have to restart tomcat rather than reload the service