Application Insights 能否记录到应用程序目录中的本地文件?我们的实现中,每个使用我们软件的客户都需要有一个单独的 Application Insights 实例。我们的客户端软件依赖于对 Web 服务的调用来获取仪器 key 。我们遇到了一些问题,在获得 Instrumentation key 之前我们需要进行日志记录。
Application Insights 可以登录到本地文件系统吗?或者它可以缓存日志以便可以探索它们吗?谢谢。
最佳答案
您可以为此目的编写自己的 channel 。实现 ITelemetryChannel
并使用其 Send 方法将遥测数据写入本地磁盘。
class FileChannel : ITelemetryChannel
{
public MyChannel()
{
}
public bool? DeveloperMode { get; set; }
public string EndpointAddress { get; set; }
public void Dispose()
{
}
public void Flush()
{
}
public void Send(ITelemetry item)
{
// logic to write item to file..
}
}
关于azure - 使用 Application Insights 记录到本地文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54259723/