Hi On Mon, Jan 10, 2011 at 3:42 PM, Daniel Kulp <[email protected]> wrote:
> On Monday 10 January 2011 3:05:57 am Idar Borlaug wrote: > > Hi > > > > I have now a bunch of services created with CXF. What i would like is > > to log all exceptions, that CXF throws to its client as SoapFaults, to > > a log file on the server. > > Whats a good way to do this? Do I have to create my own cxf interceptor? > > There are two ways to deal with this depending on what you really want to > log: > > 1) You can create your own interceptor and stick it on the FaultOut chain > on > the Bus. A subclass of our LoggingOutInterceptor would work fine and may > be > a good start. This would log the exact SOAP message as sent to the > client. > > 2) If you don't want the exact SOAP message and are really just concerned > with > the Exception itself, you can create an instance of > org.apache.cxf.logging.FaultListener > and configure that as a property on the Bus (use > org.apache.cxf.logging.FaultListener as the key, the instance as the > value). > You would get called for each exception and you can then pretty much do > whatever you want to do to log it. > > There's one more option. The rt-management contains PersistInInterceptor and PersistOutInterceptor. The latter can be injected with ExchangeDataDAO implementation which will be given the option to save Exchanges. I hope some sort of UI support will be available for this feature in the rt/management-web module in time... Cheers, Sergey > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog >
