none
WCF Trace log is only updating when service is stoped RRS feed

  • Question

  • Hi,

    We have WCF service hosted as windows service. We are using below code to enable trace of WCF messages. The problem which we face is the trace file is only updating when the windows service is stopped, Actually I need this updated immediately or at least after few minutes, is there anyway?

    Note: We hosted the service on Windows 7,  2003 server every where behavior is same.

    <system.diagnostics>
            <sources>
                <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
                    <listeners>
                        <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                            <filter type="" />
                        </add>
                        <add name="ServiceModelMessageLoggingListener">
                            <filter type="" />
                        </add>
                    </listeners>
                </source>
            </sources>
            <sharedListeners>
                <add initializeData="C:\log\messages.svclog"
                    type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                    name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
                    <filter type="" />
                </add>
            </sharedListeners>
        </system.diagnostics>
    
    ----------------------------------
    
    <diagnostics>
                <messageLogging logEntireMessage="true" logMalformedMessages="true"
                    logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
            </diagnostics>


    Thursday, November 19, 2015 5:32 AM

Answers

  • Hello Mujeeb_Rahiman,

    I have had this before and it was simply that autoflush was not on.  

    <configuration>
      <system.diagnostics>
        <trace autoflush="false" indentsize="3" />
      </system.diagnostics>
    </configuration>

    https://msdn.microsoft.com/en-us/library/system.diagnostics.trace.autoflush(v=vs.110).aspx


    Jeff

    Thursday, November 19, 2015 6:55 PM