Application Insights Trace Listener with azure functions

北城余情 提交于 2019-12-12 04:06:47

问题


I have a bunch of services which emit System.Diagnostics.Trace.* trace messages and when hosted via webapi, I simply include the Microsoft.ApplicationInsights.TraceListener package and my traces are collected in app insights. However, part of the setup requires a web.config file to tell the trace listener to listen and flush like:

<system.diagnostics>
  <sources>
    <source name="TraceLogging" switchName="Verbose">
      <listeners>
        <add name="appinsights" type="Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener, Microsoft.ApplicationInsights.TraceListener"/>
      </listeners>
    </source>
  </sources>

From this answer it doesn't seem like I can setup this up via web.confg.

Is there any way to enable the trace listener to send traces to my app insights?


回答1:


There are plans to expose configuration and logging providers extensibility that would enable scenarios like this, but this is not currently supported.



来源:https://stackoverflow.com/questions/46002677/application-insights-trace-listener-with-azure-functions

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