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 2019/07/02 12:57:32 UTC

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

Author: buildbot
Date: Tue Jul  2 12:57:32 2019
New Revision: 1047098

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 Jul  2 12:57:32 2019
@@ -32,6 +32,7 @@
 <link type="text/css" rel="stylesheet" href="/resources/highlighter/styles/shThemeCXF.css">
 
 <script src='/resources/highlighter/scripts/shCore.js'></script>
+<script src='/resources/highlighter/scripts/shBrushJava.js'></script>
 <script src='/resources/highlighter/scripts/shBrushXml.js'></script>
 <script src='/resources/highlighter/scripts/shBrushBash.js'></script>
 <script>
@@ -115,7 +116,19 @@ Apache CXF -- Message Logging
        &lt;bean class="org.apache.cxf.ext.logging.LoggingFeature"/&gt;
       &lt;/jaxws:features&gt;
     &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-Properties">Properties</h2><p>The following properties can be set on the LoggingFeature:</p><div class="table-wrap"><table class="confluenceTable"><colgroup span="1"><col span="1"><col span="1"></colgroup><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><br clear="none"></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"><colgroup span="1"><col span="1"><col span="1"></colgroup><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Fie
 ld</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" cla
 ss="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="ext
 ernal-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><br clear="none">A lot of the detail
 s are in the MDC values which are by default normally not displayed in the log file. You need to change your pax logging config to make these visible.ogged or log some services to another file.</p><h2 id="MessageLogging-Enablling/disablingloggingbychangingtheloggerconfig">Enablling / disabling logging by changing the logger config</h2><p>The logger name is "&lt;service namespace&gt;.&lt;ServiceName&gt;.&lt;type&gt;". In the karaf log file it by default only shows the type but you can change this.</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.</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 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">LogEventSender</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 accessed 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/c
 xf/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="wrapped confluenceTable"><colgroup span="1"><col span="1"><col span="1"></colgroup><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><br clear="none"></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="wrapped confluenceTable"><colgroup span="1"><col span="1"><col span="1"></colgroup><tbody><tr><th colspan="1" rowspan="1" class="c
 onfluenceTh">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 colspa
 n="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 col
 span="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><br clear="none">A l
 ot of the details are in the MDC values which are by default normally not displayed in the log file. You need to change your pax logging config to make these visible.ogged or log some services to another file.</p><h2 id="MessageLogging-Enablling/disablingloggingbychangingtheloggerconfig">Enablling / disabling logging by changing the logger config</h2><p>The logger name is "&lt;service namespace&gt;.&lt;ServiceName&gt;.&lt;type&gt;". In the karaf log file it by default only shows the type but you can change this.</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.</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 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">LogEventSender</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 accessed from the class <a shape="rect" class="external-link" href="https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/j
 ava/org/apache/cxf/ext/logging/event/LogEvent.java" rel="nofollow">LogEvent</a>.</p></div><h2 id="MessageLogging-Changingthelogginglevel">Changing the logging level</h2><p>By default, the Slf4jEventSender logs messages at "INFO" level. From CXF 3.3.3, it is possible to easily change this by setting a log level on Slf4jEventSender and wiring it into the LoggingFeature. For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Setting Debug Logging</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default">&lt;bean id="eventSender" class="org.apache.cxf.ext.logging.slf4j.Slf4jVerboseEventSender"&gt;
+    &lt;property name="loggingLevel" value="DEBUG" /&gt;
+&lt;/bean&gt;
+
+&lt;cxf:bus&gt;
+    &lt;cxf:features&gt;
+        &lt;bean class="org.apache.cxf.ext.logging.LoggingFeature"&gt;
+            &lt;property name="sender" ref="eventSender"/&gt;
+        &lt;/bean&gt;
+    &lt;/cxf:features&gt;
+&lt;/cxf:bus&gt;</pre>
+</div></div><p><br clear="none"></p><p><br clear="none"></p><div class="container" title="Hint: double-click to select code"><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">feature:repo-add cxf 3.1.0
 feature:install cxf-features-logging
 config:property-set -p org.apache.cxf.features.logging enabled true</pre>