Tutorial :Diagnostic Trace Logging Not Working when Deployed to IIS 7



Question:

I am working on migrating a site from IIS 6 to IIS 7 and I am not able to see all of my logs. My system.diagnostics configuration is as follows:

<system.diagnostics>    <trace autoflush="true"></trace>    <sources>      <source name="Assembly1" switchValue="All">        <listeners>          <add name="DiagnosticMessageTraceListener"               type="System.Diagnostics.TextWriterTraceListener"               traceOutputOptions="ProcessId, ThreadId, DateTime"               initializeData="E:\Inetpub\logs\App\Assembly1.log" />        </listeners>      </source>      <source name="Assembly2" switchValue="All">        <listeners>          <add name="DiagnosticMessageTraceListener"               type="System.Diagnostics.TextWriterTraceListener"               traceOutputOptions="ProcessId, ThreadId, DateTime"               initializeData="E:\Inetpub\logs\App\Assembly2.log" />        </listeners>      </source>      <source name="Assebly3" switchValue="All">        <listeners>          <add name="DiagnosticMessageTraceListener"               type="System.Diagnostics.TextWriterTraceListener"               traceOutputOptions="ProcessId, ThreadId, DateTime"               initializeData="E:\Inetpub\logs\App\Assembly3.log" />        </listeners>      </source>      <source name="System.ServiceModel" switchValue="All" propagateActivity="true">        <listeners>          <add name="DiagnosticMessageTraceListener"               type="System.Diagnostics.XmlWriterTraceListener"               initializeData="E:\Inetpub\logs\App\ServiceTrace.svclog" />        </listeners>      </source>      <source name="System.ServiceModel.MessageLogging" switchValue="All">        <listeners>          <add name="DiagnosticMessageTraceListener"               type="System.Diagnostics.XmlWriterTraceListener"               initializeData="E:\Inetpub\logs\App\ServiceMessages.svclog" />        </listeners>      </source>    </sources>    <switches>      <add name="System.Net" value="Verbose" />      <add name="System.Net.Sockets" value="Verbose" />    </switches>  </system.diagnostics>  

If I run the application locally using the ASP.Net web server or local IIS I get all my log files. Once the application has been deployed to IIS 7 I only get the System.ServiceModel log. I have verified that the directory exists and I have given full control to everybody. I also have restarted the services and the site in an attempt to force the logs to flush. I have just been trying anything to get a log out of this thing so I also installed the Tracing and Logging Tools role services. I still don't get my application logs.

I also tried an implementation where I logged to the EventLog instead of trace log files. This also exhibited the same behavior. Worked locally and when deployed to local IIS but not when deployed to the actual server. I logged to the application log and on my IIS7 machine I gave full control permission to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application.

Seems like I must be missing something here. I can't get any information out of these 2 different logging implementations when deployed within IIS 7. I'm not even sure what is common here. Do EventLog.WriteEntry and Trace.TraceEvent both use WCF?


Solution:1

Let Everyone has Full Access permissions on E:\Inetpub\logs\App\

About other permission issues, learn about IIS 7 changes on user account,

http://learn.iis.net/page.aspx/110/changes-between-iis-60-and-iis-7-security/


Solution:2

You might have more joy moving your log files out of the Inetpub directory. I certainly did, even though I set the correct permission for the IIS pool user.

Try <initializeData="E:\logs\Apps\ServiceTrace.svclog" />


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »