Diagnostic Trace Logging Not Working when Deployed to IIS 7

我与影子孤独终老i 提交于 2019-12-20 04:08:21

问题


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?


回答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/




回答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" />



来源:https://stackoverflow.com/questions/3113650/diagnostic-trace-logging-not-working-when-deployed-to-iis-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!