0

我为 NET Core 运行示例:[https://github.com/mattwcole/gelf-extensions-logging/blob/dev/samples/Gelf.Extensions.Logging.Samples.NetCore2/Program.cs][1]

然后我运行了 Docker https://docs.graylog.org/en/4.0/pages/installation/docker.html?highlight=docker

然后我稍微更正了 appsettings.json 文件:

{
  "Logging": {
    "Console": {
      "LogLevel": {
        "Default": "Debug"
      }
    },
    "GELF": {
      "Host": "127.0.0.1",
      "Port": 12201,
      "LogSource": "console-app-1",
      "LogLevel": {
        "Default": "Debug",
        "Microsoft": "Debug",
        "Gelf.Extensions.Logging.Samples.NetCore2": "Debug",
        "Gelf.Extensions.Logging.Samples.NetCore2.Program": "Debug"
      },
      "LogLevel2": {
        "Microsoft.AspNetCore.Mvc.Razor": "Error",
        "Default": "Trace"
      },
      "AdditionalFields": {
        "project_name": "my-project"
      }
    }
  }
}

运行该应用程序,它可以工作,但是当我转到浏览器 http://localhost:9000/search?q=&rangetype=relative&relative=1800 时,我没有看到任何记录。我做错了什么?

4

1 回答 1

0

需要检查 Docker GrayLog 配置:尤其是 GELF 输入本地和全局。

于 2021-04-22T11:50:34.237 回答