使用Azure功能进行日志记录〜2.0

时间:2019-05-23 10:14:43

标签: c# azure-functions

我正在尝试将Microsoft.Logging.Extension与Azure Functions〜2集成。

LogLevel = Error 以下的日志未显示在Azure日志流或Kudu中。在本地运行时,日志确实会显示在控制台中。

我按如下方式创建工厂:

LoggerFactory factory = new LoggerFactory();
factory
    .AddAzureWebAppDiagnostics()
    .AddConsole();

然后我尝试使用记录器,如下所示:

factory.CreateLogger<TestClass>().LogInformation("This is a test information message.");

我的问题是:除非级别为错误

,否则日志不会显示在Kudu / Azure日志流中

我的host.json文件如下:

{
  "version": "2.0",
  "singleton": {
    "listenerLockPeriod": "00:00:15"
  },
  "logging": {
    "console": {
      "isEnabled": "true"
    },
    "fileLoggingMode": "debugOnly",
    "logLevel": {
      "default": "Information"
    }
  }
}

我想念什么?

0 个答案:

没有答案
相关问题