<add> of <filters>

A XPath filter that specifies the kind of message to be logged.

Schema Hierarchy

<system.serviceModel>
  <diagnostics>
    <messageLogging>
      <filters>
        <add> of <filters>

Syntax

<filters>
   <add filter="String"/>
</filters>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

filter

A string that specifies a query on an XML document defined by an XPath 1.0 expression. For more information, see XPathMessageFilter.

Child Elements

None.

Parent Elements

Element Description

<filters>

Contains a collection of XPath filters used to control what kind of message is logged.

Remarks

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.

Example

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
XpathMessageFilterElement
XPathMessageFilter

Other Resources

Configuring Message Logging
Message Loggging


© 2007 Microsoft Corporation. All rights reserved.
Last Published: 2010-01-05