Azure wcf服务Trace.WriteLine请求去哪里?

Azure wcf服务Trace.WriteLine请求去哪里?,wcf,azure,Wcf,Azure,我看过很多不同的Azure和Wcf服务示例。我已经配置了一个跟踪侦听器,很多跟踪信息出现在相关的日志文件中;但是,我看不到Trace.WriteLine请求的结果。我确实在Azure调试器输出面板中看到了Trace.WriteLine请求。。这些请求的输出保存在哪里 从我的Web.config <system.diagnostics> <sources> <source propagateActivity="false" name="System.Service

我看过很多不同的Azure和Wcf服务示例。我已经配置了一个跟踪侦听器,很多跟踪信息出现在相关的日志文件中;但是,我看不到Trace.WriteLine请求的结果。我确实在Azure调试器输出面板中看到了Trace.WriteLine请求。。这些请求的输出保存在哪里

从我的Web.config

<system.diagnostics>
<sources>
  <source propagateActivity="false" name="System.ServiceModel"
    switchValue="Verbose,ActivityTracing">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="AzureLocalStorage">
        <filter type="" />
      </add>
    </listeners>
  </source>
  <source name="System.ServiceModel.MessageLogging" switchValue="Information">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="AzureLocalStorage">
        <filter type="" />
      </add>
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add type="WCFServiceWebRole1.AzureLocalStorageTraceListener, WCFServiceWebRole1"
    name="AzureLocalStorage">
    <filter type="" />
  </add>
</sharedListeners>
<trace autoflush="true" />

您创建的AzureLocalStorageTraceListener只需将日志记录到*.svclog文件中即可。如果要将日志输出到emulator,则应注意以下几点:

  • 将DevelopmentFabricTraceListener添加到共享侦听器(这也适用于1.7SDK)

    
    
  • 确保开关值正确(您可以尝试使用值All开始)

  • 更改emulator中的日志记录级别(通过右键单击屏幕右上角的图标)
  •     public class AzureLocalStorageTraceListener : XmlWriterTraceListener
    {
        public AzureLocalStorageTraceListener()
            : base(Path.Combine(AzureLocalStorageTraceListener.GetLogDirectory().Path, "WCFServiceWebRole1.svclog"))
        {
        }
    
        public static DirectoryConfiguration GetLogDirectory()
        {
            DirectoryConfiguration directory = new DirectoryConfiguration();
            directory.Container = "wad-tracefiles";
            directory.DirectoryQuotaInMB = 10;
            directory.Path = RoleEnvironment.GetLocalResource("WCFServiceWebRole1.svclog").RootPath;
            return directory;
        }
    }
    
    <add type="Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime.DevelopmentFabricTraceListener, Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Emulator">
      <filter type="" />
    </add>