代码之家  ›  专栏  ›  技术社区  ›  MatterOfFact

Application Insights遥测客户端-如何显示被调用方法的日志条目

  •  0
  • MatterOfFact  · 技术社区  · 5 年前

    using (_telemetryClient.StartOperation<RequestTelemetry>("someOperationName"))
                    { [service implementation goes here] }
    

    在我使用的服务实现中_logger.login信息. 我还在服务实现中调用不同类的其他方法,这些方法也记录信息。

    这些条目不会在Azure中显示。

    是否有一种方法可以自动显示Azure Application Insights(性能->操作选项卡)中所有调用方法的日志条目?

    "Logging": {
        "ApplicationInsights": {
            "LogLevel": {
                "Default": "Information"
            }
        },
        "LogLevel": {
            "Default": "Warning",
            "Microsoft.Hosting.Lifetime": "Information"
        },
        "AllowedHosts": "*"
    },
    

            services.AddHostedService<Worker>();
            services.AddApplicationInsightsTelemetryWorkerService();
    

    我遵循这些指示: https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service#net-core-30-worker-service-application

    0 回复  |  直到 5 年前
        1
  •  0
  •   Ivan Glasenberg    5 年前

    根据op提供的代码/配置,两者都是正确的。我也确认在我身边,它的工作。