You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2018/03/06 11:57:20 UTC

svn commit: r1026341 - in /websites/production/cxf/content: cache/docs.pageCache docs/message-logging.html

Author: buildbot
Date: Tue Mar  6 11:57:20 2018
New Revision: 1026341

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/message-logging.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/message-logging.html
==============================================================================
--- websites/production/cxf/content/docs/message-logging.html (original)
+++ websites/production/cxf/content/docs/message-logging.html Tue Mar  6 11:57:20 2018
@@ -123,7 +123,7 @@ Apache CXF -- Message Logging
        <bean class="org.apache.cxf.ext.logging.LoggingFeature"/>
       </jaxws:features>
     &lt;/jaxws:endpoint&gt;</pre>
-</div></div><p>The LoggingFeature can be used with JAXWS as well JAXRS Endpoints and Clients. It can also be specified using the @Features annotation. The feature should be used instead of adding the LoggingIn/OutInterceptors manually.</p><h2 id="MessageLogging-Slf4jMDCvaluesformetadata">Slf4j MDC values for meta data</h2><p>This is the raw logging information you get for a SOAP call:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Field</th><th colspan="1" rowspan="1" class="confluenceTh">Value</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">@timestamp</td><td colspan="1" rowspan="1" class="confluenceTd">2015-06-08T14:43:27,097Z</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.address</td><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://localhost:8181/cxf/personService" rel="nofollow">http://localhost:8181/cxf/personService</a></td>
 </tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://MDC.bundle.id" rel="nofollow">MDC.bundle.id</a></td><td colspan="1" rowspan="1" class="confluenceTd">90</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://MDC.bundle.name" rel="nofollow">MDC.bundle.name</a></td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.cxf-rt-features-logging</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.bundle.version</td><td colspan="1" rowspan="1" class="confluenceTd">3.1.0</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.content-type</td><td colspan="1" rowspan="1" class="confluenceTd">text/xml; charset=UTF-8</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.encoding</td><td colspan="1" rowspan="1" class="confluenceTd">UTF-8</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.exchangeId</td><td colspan="1" 
 rowspan="1" class="confluenceTd">56b037e3-d254-4fe5-8723-f442835fa128</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.headers</td><td colspan="1" rowspan="1" class="confluenceTd">{content-type=text/xml; charset=UTF-8, connection=keep-alive, Host=localhost:8181, Content-Length=251, SOAPAction="", User-Agent=Apache CXF 3.1.0, Accept=*/*, Pragma=no-cache, Cache-Control=no-cache}</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.httpMethod</td><td colspan="1" rowspan="1" class="confluenceTd">POST</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.messageId</td><td colspan="1" rowspan="1" class="confluenceTd">a46eebd2-60af-4975-ba42-8b8205ac884c</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.portName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonServiceImplPort</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.portTypeName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonService</td
 ></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.serviceName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonServiceImplService</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.type</td><td colspan="1" rowspan="1" class="confluenceTd">REQ_IN</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">level</td><td colspan="1" rowspan="1" class="confluenceTd">INFO</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.class</td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.ext.logging.slf4j.Slf4jEventSender</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.file</td><td colspan="1" rowspan="1" class="confluenceTd">Slf4jEventSender.java</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.line</td><td colspan="1" rowspan="1" class="confluenceTd">55</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.method</td><td colspan="1" rowspan="1" class="confluenceTd">send</td></tr
 ><tr><td colspan="1" rowspan="1" class="confluenceTd">loggerClass</td><td colspan="1" rowspan="1" class="confluenceTd">org.ops4j.pax.logging.slf4j.Slf4jLogger</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loggerName</td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.services.PersonService.REQ_IN</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">message</td><td colspan="1" rowspan="1" class="confluenceTd">&lt;soap:Envelope xmlns:soap="<a shape="rect" class="external-link" href="http://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoap:Body%3E%3Cns2:getAll" rel="nofollow">http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns2:getAll</a> xmlns:ns2="<a shape="rect" class="external-link" href="http://model.personservice.cxf.karaf.tutorial.lr.net/%22" rel="nofollow">http://model.personservice.cxf.karaf.tutorial.lr.net/"</a>; xmlns:ns3="<a shape="rect" class="external-link" href="http://person.jms2rest.camel.karaf.tutorial.lr.net%22
 /%3E%3C/soap:Body%3E%3C/soap:Envelope%3E" rel="nofollow">http://person.jms2rest.camel.karaf.tutorial.lr.net"/&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</a>;</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">threadName</td><td colspan="1" rowspan="1" class="confluenceTd">qtp80604361-78</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">timeStamp</td><td colspan="1" rowspan="1" class="confluenceTd">1433774607097</td></tr></tbody></table></div><p>Some things to note:</p><ul><li>The logger name is &lt;service namespace&gt;.&lt;ServiceName&gt;.&lt;type&gt; karaf by default only cuts it to just the type.</li><li>A lot of the details are in the MDC values</li></ul><p>You need to change your pax logging config to make these visible.</p><p>You can use the logger name to fine tune which services you want to log this way. For example set the debug level to WARN for noisy services to avoid that they are logged or log some services to another file.</p><h2 id="MessageLogg
 ing-Messageidandexchangeid">Message id and exchange id</h2><p>The messageId allows to uniquely identify messages even if they were collected from several servers. It is also transported over the wire so a request sent on one machine can be correlated with the request received on another machine.</p><p>The exchangeId will be the same for an incoming request and the response sent out or on the other side for an outgoing request and the response for it. This allows to correlate request and responses and so follow the conversations.</p><h2 id="MessageLogging-Simpleinterfacetowritecustomappenders">Simple interface to write custom appenders</h2><p>Write a custom <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/LogEventSender.java" rel="nofollow">LogSender</a> and set it on the <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/m
 ain/java/org/apache/cxf/ext/logging/LoggingFeature.java" rel="nofollow">LoggingFeature</a> to do custom logging. All meta data can be access from the class <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/LogEvent.java" rel="nofollow">LogEvent</a>.</p><h2 id="MessageLogging-AutologgingforexistingCXFendpointsandclientsinApacheKaraf">Auto logging for existing CXF endpoints and clients in Apache Karaf</h2><p>To use the message logging in karaf it needs to be installed as a feature. It can then be activated for all endpoints using a config.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Logging feature in karaf</b></div><div class="codeContent panelContent pdl">
+</div></div><p>The LoggingFeature can be used with JAXWS as well JAXRS Endpoints and Clients. It can also be specified using the @Features annotation. The feature should be used instead of adding the LoggingIn/OutInterceptors manually.</p><h2 id="MessageLogging-Properties">Properties</h2><p>The following properties can be set on the LoggingFeature:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Property</th><th colspan="1" rowspan="1" class="confluenceTh">Explanation</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">limit</td><td colspan="1" rowspan="1" class="confluenceTd">The size limit at which messages are truncated in the log. The default is 48 * 1024.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">inMemThreshold</td><td colspan="1" rowspan="1" class="confluenceTd"><p>Size limit when messages are written to disk. The default is -1, which means do not write to disk.</p></td></tr><tr
 ><td colspan="1" rowspan="1" class="confluenceTd">prettyLogging</td><td colspan="1" rowspan="1" class="confluenceTd">For XML content, turn on pretty printing in the logs. The default is false.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">logBinary</td><td colspan="1" rowspan="1" class="confluenceTd">Log binary payloads by default. The default is false.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">logMultipart</td><td colspan="1" rowspan="1" class="confluenceTd">Log multipart payloads by default. The default is true.</td></tr></tbody></table></div><p>&#160;</p><h2 id="MessageLogging-Slf4jMDCvaluesformetadata">Slf4j MDC values for meta data</h2><p>This is the raw logging information you get for a SOAP call:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Field</th><th colspan="1" rowspan="1" class="confluenceTh">Value</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">@ti
 mestamp</td><td colspan="1" rowspan="1" class="confluenceTd">2015-06-08T14:43:27,097Z</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.address</td><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://localhost:8181/cxf/personService" rel="nofollow">http://localhost:8181/cxf/personService</a></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://MDC.bundle.id" rel="nofollow">MDC.bundle.id</a></td><td colspan="1" rowspan="1" class="confluenceTd">90</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><a shape="rect" class="external-link" href="http://MDC.bundle.name" rel="nofollow">MDC.bundle.name</a></td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.cxf-rt-features-logging</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.bundle.version</td><td colspan="1" rowspan="1" class="confluenceTd">3.1.0</td></tr><tr><td colspan="
 1" rowspan="1" class="confluenceTd">MDC.content-type</td><td colspan="1" rowspan="1" class="confluenceTd">text/xml; charset=UTF-8</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.encoding</td><td colspan="1" rowspan="1" class="confluenceTd">UTF-8</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.exchangeId</td><td colspan="1" rowspan="1" class="confluenceTd">56b037e3-d254-4fe5-8723-f442835fa128</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.headers</td><td colspan="1" rowspan="1" class="confluenceTd">{content-type=text/xml; charset=UTF-8, connection=keep-alive, Host=localhost:8181, Content-Length=251, SOAPAction="", User-Agent=Apache CXF 3.1.0, Accept=*/*, Pragma=no-cache, Cache-Control=no-cache}</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.httpMethod</td><td colspan="1" rowspan="1" class="confluenceTd">POST</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.messageId</td><td colspan="1" rowspan=
 "1" class="confluenceTd">a46eebd2-60af-4975-ba42-8b8205ac884c</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.portName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonServiceImplPort</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.portTypeName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonService</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.serviceName</td><td colspan="1" rowspan="1" class="confluenceTd">PersonServiceImplService</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">MDC.type</td><td colspan="1" rowspan="1" class="confluenceTd">REQ_IN</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">level</td><td colspan="1" rowspan="1" class="confluenceTd">INFO</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.class</td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.ext.logging.slf4j.Slf4jEventSender</td></tr><tr><td colspan="1" rowspan="1" class="con
 fluenceTd">loc.file</td><td colspan="1" rowspan="1" class="confluenceTd">Slf4jEventSender.java</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.line</td><td colspan="1" rowspan="1" class="confluenceTd">55</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loc.method</td><td colspan="1" rowspan="1" class="confluenceTd">send</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loggerClass</td><td colspan="1" rowspan="1" class="confluenceTd">org.ops4j.pax.logging.slf4j.Slf4jLogger</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">loggerName</td><td colspan="1" rowspan="1" class="confluenceTd">org.apache.cxf.services.PersonService.REQ_IN</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">message</td><td colspan="1" rowspan="1" class="confluenceTd">&lt;soap:Envelope xmlns:soap="<a shape="rect" class="external-link" href="http://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoap:Body%3E%3Cns2:getAll" rel="nofollow">http://schemas.xm
 lsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns2:getAll</a> xmlns:ns2="<a shape="rect" class="external-link" href="http://model.personservice.cxf.karaf.tutorial.lr.net/%22" rel="nofollow">http://model.personservice.cxf.karaf.tutorial.lr.net/"</a>; xmlns:ns3="<a shape="rect" class="external-link" href="http://person.jms2rest.camel.karaf.tutorial.lr.net%22/%3E%3C/soap:Body%3E%3C/soap:Envelope%3E" rel="nofollow">http://person.jms2rest.camel.karaf.tutorial.lr.net"/&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</a>;</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">threadName</td><td colspan="1" rowspan="1" class="confluenceTd">qtp80604361-78</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">timeStamp</td><td colspan="1" rowspan="1" class="confluenceTd">1433774607097</td></tr></tbody></table></div><p>Some things to note:</p><ul><li>The logger name is &lt;service namespace&gt;.&lt;ServiceName&gt;.&lt;type&gt; karaf by default only cuts it to just the type.</li><
 li>A lot of the details are in the MDC values</li></ul><p>You need to change your pax logging config to make these visible.</p><p>You can use the logger name to fine tune which services you want to log this way. For example set the debug level to WARN for noisy services to avoid that they are logged or log some services to another file.</p><h2 id="MessageLogging-Messageidandexchangeid">Message id and exchange id</h2><p>The messageId allows to uniquely identify messages even if they were collected from several servers. It is also transported over the wire so a request sent on one machine can be correlated with the request received on another machine.</p><p>The exchangeId will be the same for an incoming request and the response sent out or on the other side for an outgoing request and the response for it. This allows to correlate request and responses and so follow the conversations.</p><h2 id="MessageLogging-Simpleinterfacetowritecustomappenders">Simple interface to write custom app
 enders</h2><p>Write a custom <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/LogEventSender.java" rel="nofollow">LogSender</a> and set it on the <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java" rel="nofollow">LoggingFeature</a> to do custom logging. All meta data can be access from the class <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/event/LogEvent.java" rel="nofollow">LogEvent</a>.</p><h2 id="MessageLogging-AutologgingforexistingCXFendpointsandclientsinApacheKaraf">Auto logging for existing CXF endpoints and clients in Apache Karaf</h2><p>To use the message logging in karaf it needs to be installed as a feature. It can then be activated for all endpoints using
  a config.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Logging feature in karaf</b></div><div class="codeContent panelContent pdl">
 <pre class="brush: bash; gutter: false; theme: Default" style="font-size:12px;">feature:repo-add cxf 3.1.0
 feature:install cxf-features-logging
 config:property-set -p org.apache.cxf.features.logging enabled true</pre>