Can I enable tracing in OWIN?

混江龙づ霸主 提交于 2019-12-01 03:12:26

Not 100% sure that this will solve your issue, but we got it working with following config. Slight difference in the following line:

<source name="Microsoft.Owin" switchName="Microsoft.Owin" switchType="System.Diagnostics.SourceSwitch">

Notice that the <source> tag includes a switchName (and switchType) attribute which is missing from your example. I think that this instruction links the TraceSource with the Switch and makes the entire work.

In our case, we use trace listeners for Azure Web sites (and web jobs).

 <system.diagnostics>
    <sharedListeners>
      <add name="AzureTableTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureTableTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add name="AzureBlobTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureBlobTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
      <add name="AzureDriveTraceListener" type="Microsoft.WindowsAzure.WebSites.Diagnostics.AzureDriveTraceListener, Microsoft.WindowsAzure.WebSites.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </sharedListeners>
    <sources>
      <source name="Microsoft.Owin" switchName="Microsoft.Owin" switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <add name="AzureTableTraceListener"/>
          <add name="AzureDriveTraceListener"/>
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="Microsoft.Owin" value="All" />
    </switches>
    <trace autoflush="true" indentsize="4" />
  </system.diagnostics>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!