开发者

WCF Diagnostics "logEntireMessage" left on in deployed environment

开发者 https://www.devze.com 2023-01-23 05:37 出处:网络
I have a WCF service exposed (.net 3.5). I am using diagnostics to log messages and activities when required. Here is my code:

I have a WCF service exposed (.net 3.5).

I am using diagnostics to log messages and activities when required. Here is my code:

The following defines which messages to log:

<system.serviceModel>
    <diagnostics>
      <messageLogging
         logEntireMessage="true"
         logMalformedMessages="true"
         logMessagesAtServiceLevel="true"
         logMessagesAtTransportLevel="true"
         maxMessagesToLog="3000000"
         maxSizeOfMessageToLog="20000000"/>
    </diagnostics>
</system.serviceModel>

The following specifies where to log to:

<system.diagnostics>
    <trace autoflush="true" indentsize=开发者_JAVA技巧"4" />
    <sources>
      <!-- Source for tracing WCF activities. -->
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener"
             initializeData="ActivityLog.svclog" />
        </listeners>
      </source>


      <!-- Source for tracing WCF messages (content). -->
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="messageListner" type="System.Diagnostics.XmlWriterTraceListener"
            initializeData="MessageLog.svclog" />
        </listeners>
      </source>

    </sources>
</system.diagnostics>

When I comment the sources out, it does not log to the files (obviously).

My question is can I leave the diagnostics element in there or should I comment it out (will it affect performance/anything when deployed)?


I don't think it will make a difference as it needs to build the listeners before any diagnostics takes place.

0

精彩评论

暂无评论...
验证码 换一张
取 消