【发布时间】:2017-07-04 09:13:19
【问题描述】:
我在控制台应用程序上运行了 Log4Net,并且希望将日志事件转到 Application Insights。
我无法通过右键单击我的项目来添加 AI - 它没有显示为选项。
我已经通过 NuGet 安装了 AI SDK,并且能够创建遥测客户端,但不知道在哪里添加检测密钥。
This教程说:
在您的代码中设置检测密钥:
TelemetryConfiguration.Active.InstrumentationKey = " your key ";
或在 ApplicationInsights.config 中(如果您安装了标准遥测包之一):
<InstrumentationKey>your key</InstrumentationKey>
我没有 ApplicationInsights.config 文件,因为我无法将 AI 添加到项目中。如果我像这样在实例化遥测客户端时添加密钥,它会起作用吗?
var telemetryClient = new TelemetryClient { InstrumentationKey = ConfigurationManager.AppSettings["applicationInsights"] };
【问题讨论】:
标签: log4net azure-application-insights