none
WCF tracing diagnostics not creating svclog files on server

    Question

  • Hi, I have configured WCF tracing on my WCF service but unfortunately the .svclog files are not being created in the directory I specified. I realise it is similar to this problem http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/7a372b9e-8e2a-4704-a96e-95cf66a7e6c2 but unfortunately the fixes highlighted here did not fix my problem. Any ideas why this would not be working?

    I am hosting the WCF service in IIS7 on a Windows Server 2008 machine, and I can add a reference to a test project and call the methods fine (well, some of them, that's why I want tracing enabled...)

    I've tried giving full access to the output folder to pretty much everyone without any luck.

    My service web.config file is as follows:

     <system.diagnostics>
     <trace autoflush="true" />
     <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="All">
      <listeners>
       <add type="System.Diagnostics.DefaultTraceListener" name="Default">
       <filter type="" />
       </add>
       <add name="ServiceModelMessageLoggingListener">
       <filter type="" />
       </add>
      </listeners>
      </source>
      <source name="System.ServiceModel" switchValue="All"
      propagateActivity="true">
      <listeners>
       <add type="System.Diagnostics.DefaultTraceListener" name="Default">
       <filter type="" />
       </add>
       <add name="ServiceModelTraceListener">
       <filter type="" />
       </add>
      </listeners>
      </source>
     </sources>
     <sharedListeners>
      <add initializeData="C:\WCFTRACE\app_messages.svclog"
      type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
      <filter type="" />
      </add>
      <add initializeData="C:\WCFTRACE\app_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
      <filter type="" />
      </add>
     </sharedListeners>
     </system.diagnostics>
    <!-- END -->
     <system.serviceModel>
     <diagnostics>
      <messageLogging logMalformedMessages="true" logEntireMessage="true" logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" />
     </diagnostics>
    ...
    

    Let me know if you need any more info, many thanks,

    Mike


    Friday, July 29, 2011 12:30 PM

All replies

  • you gave access to prety much everyone - to be on the safe side give full recursive access to the user "everyone".

    to check if this is a permission issue try to take one of the working methods and write to that folder from it.

    also try on another machine.

    in most cases it is somehow related to permisssions.


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Friday, July 29, 2011 5:37 PM
  • Yes I gave full control to 'everyone', I was trying to be subtle :)

    I created a new method in the service that took a string parameter and wrote that string to a file in the same folder, which worked perfectly (well, it wrote the file to the folder but still didn't create any diagnostic files). I have tried on my development environment and it is working OK (creating the logs etc.), which is what makes me think I have my service config file wrong.

    Anything else anyone can think of?

    Cheers, Mike

    Monday, August 01, 2011 8:40 AM
  • so the exact same file generates log on your dev machine? try to use the same path so not to change anything.

    also on the server try to change the log location to the web site folder itself


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Monday, August 01, 2011 8:47 PM
  • Yes I used the same path to start with. The web site folder? I assume you mean the location of the .svc file (It's hosted on a SharePoint site so it's not quite as easy as just putting it in the site directory)? I changed the location to this (e.g. www.sharepointsite.com/_wcf/genservice.svc) and no luck. My original problem that I needed tracing enabled for was the fact that I wasn't passing credentials through properly, as the service was interrogating a SharePoint search store. If that helps.

    Cheers, Mike.

    Tuesday, August 02, 2011 7:36 AM
  • Does anyone have any ideas on this? If any moderators are listening, I promise I'll stop posting other questions on this forum that people can't answer if this one gets fixed, cos then I'll know what's going wrong with my service :)

    This is a real headache for me as I have no idea what's going wrong with the rest of my service.

    Thanks.

    Thursday, August 04, 2011 3:18 PM
  • This is what my xml file looks like....

    <system.diagnostics>
    
      <sources>
    
       <source name="System.ServiceModel" switchValue="Error,ActivityTracing" propagateActivity="true">
    
        <listeners>
    
         <add type="System.Diagnostics.DefaultTraceListener" name="Default">
    
          <filter type="" />
    
         </add>
    
         <add name="ServiceModelTraceListener">
    
          <filter type="" />
    
         </add>
    
        </listeners>
    
       </source>
    
       <source name="System.ServiceModel.MessageLogging" switchValue="Error,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:\WebLogs\CMS\Web_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
    
        <filter type="" />
    
       </add>
    
       <add initializeData="C:\WebLogs\CMS\Web_messages.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
    
        <filter type="" />
    
       </add>
    
      </sharedListeners>
    
      <trace autoflush="true" />
    
     </system.diagnostics>
    
    

    But here is the thing i changed the permission for local admin and system to full on that folder. You can always narrow it down. I never gave Everyone the permission. It worked me . I hope this works for you too.


    Get Coded ..............
    Thursday, August 04, 2011 4:39 PM
  • Yes this isn't far off from mine, except you autoflush trace after declaring the initialisation data. Can't see anything there that would produce a different outcome apart from write less to the log. Also, I would think giving 'everyone' full access to the folder would actually allow everyone full permissions to that folder. I did however try just the local admins and IIS user full access initially.

    Thanks for the effort though!

    Monday, August 08, 2011 8:27 AM
  • I don't know if this helps, but I was making the dumb mistake of trying to write to a folder that didn't exist.  I was trying to write to:

    initializeData="c:\log\Traces.svclog"

    However, C:\log folder didn't exist.

    I had assuming that the folders would be created with the file, but assumed wrong.  As soon as I manually created the C:\log folder the traces showed up in it.

    HTH,

    Bob

    Saturday, September 17, 2011 7:25 PM