You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Drake Faith <dd...@gmail.com> on 2017/03/14 14:02:23 UTC

Using raw logging information from a SOAP call

Hi!

I was wondering how to use raw logging information.
Currently I want to log SOAP XMLs. According to
http://cxf.apache.org/docs/message-logging.html SOAP body could be read
from message.

While using log4j with LoggingFeature, my appender pattern:
%d{ISO8601} %m%n

My logging record:
2017-03-14 14:57:17,783|Inbound Message
----------------------------
ID: 1
Address:
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml;charset=UTF-8
Headers:
Payload: SOAP
--------------------------------------
2017-03-14 14:57:18,792|Outbound Message
---------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml
Headers: {}
Payload: SOAP
--------------------------------------

Could you explain how to get only SOAP msg? By extends LoggingIn/Out
Interceptor or there is any easy way?

Best regards,
Drake

Re: Using raw logging information from a SOAP call

Posted by Christian Schneider <ch...@die-schneider.net>.
Are you sure you are using the new message logging from the 
rt/features/logging module?

The new logging by default only sends the payload as the message to make 
it easy for you to extract it.
In 3.2.0 we change this behaviour to give you the logging below again by 
default but you can still set it to only log the payload in the log message.
(All other details will be in MDC values that you can also optionally 
show in the log).

See here for the options you can set on the feature:
https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
Set verbose to false to only show the payload in the main log message.

Additionally if you have special needs you can set your custom 
LogEventSender which can do anything with the raw payload and meta data.
So this makes it easy to for example log to a database or elastic search 
or similar.

If you run in Apache Karaf then you should also take a look at Apache 
Karaf Decanter.
See: 
http://mirror.netcologne.de/apache.org/karaf/documentation/decanter/1_x.html
It allows to log to elastic search or kafka with very minimal effort.

Christian

On 14.03.2017 15:02, Drake Faith wrote:
> Hi!
>
> I was wondering how to use raw logging information.
> Currently I want to log SOAP XMLs. According to
> http://cxf.apache.org/docs/message-logging.html SOAP body could be read
> from message.
>
> While using log4j with LoggingFeature, my appender pattern:
> %d{ISO8601} %m%n
>
> My logging record:
> 2017-03-14 14:57:17,783|Inbound Message
> ----------------------------
> ID: 1
> Address:
> Encoding: UTF-8
> Http-Method: POST
> Content-Type: text/xml;charset=UTF-8
> Headers:
> Payload: SOAP
> --------------------------------------
> 2017-03-14 14:57:18,792|Outbound Message
> ---------------------------
> ID: 1
> Response-Code: 200
> Encoding: UTF-8
> Content-Type: text/xml
> Headers: {}
> Payload: SOAP
> --------------------------------------
>
> Could you explain how to get only SOAP msg? By extends LoggingIn/Out
> Interceptor or there is any easy way?
>
> Best regards,
> Drake
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com