<filters>

The filters element holds a collection of XPath filters used to control what kind of message is logged.

Filters are applied only at the transport layer, specified by logMessagesAtTransportLevel is true. Service level and malformed message logging are not affected by filters.

To add a filter to the collection, use the add keyword. When one or more filters are defined, only messages that match at least one of the filters are logged. If no filter is defined, all messages pass through.

Filters support the full XPath syntax, and are applied in the order they appear in the configuration file. A syntactically incorrect filter results in a configuration exception.

The following is an example of how to configure a filter that records only messages that have a SOAP Header section.

<messageLogging logEntireMessage="true"
     logMalformedMessages="true" logMessagesAtServiceLevel="true"
     logMessagesAtTransportLevel="true" maxMessagesToLog="420”>
     <filters>
        <add xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
                        /soap:Envelope/soap:Headers
        </add>
     </filters>
</messageLogging>

See Also

Reference

<messageLogging>
DiagnosticSection
System.ServiceModel.Diagnostics
MessageLogging
MessageLoggingElement
Filters
XpathMessageFilterElementCollection
XpathMessageFilterElement
XPathMessageFilter

Other Resources

Configuring Message Logging
Message Loggging