问题
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