.NetCore 日志在 GCP Stackdriver 中输出错误的严重性
.NetCore log output wrong severity in GCP Stackdriver
.netcore 应用程序的默认日志条目正在写入标准输出并由 GCP Stackdriver 解释为 info 消息,即使它是 错误。有没有办法将 .netcore 错误写入 stderr 或以某种方式配置它们,以便 Stackdriver 将它们解释为错误?
Stackdriver 日志条目:
.netcore 应用日志条目:
根据 Panagiotis Kanavos@:
If you insist on writing to console you'll have to remove the default console logger and add another one. The Microsoft.Extensions.Logging.Console
logger is very basic, with a hard-coded format that writes parts of a single event in different lines. It can't be customised and isn't meant to - it's only meant to be the most basic default. Serilog's Console provider offers extensive customisation but why use the console when you can already send events to StackDriver?
这确实解决了最初的问题,根据 Kiramm@:
I removed the default console logger and added Google's logger factory and the Stackdriver started interpreting log entries severity correctly
.netcore 应用程序的默认日志条目正在写入标准输出并由 GCP Stackdriver 解释为 info 消息,即使它是 错误。有没有办法将 .netcore 错误写入 stderr 或以某种方式配置它们,以便 Stackdriver 将它们解释为错误?
Stackdriver 日志条目:
.netcore 应用日志条目:
根据 Panagiotis Kanavos@:
If you insist on writing to console you'll have to remove the default console logger and add another one. The
Microsoft.Extensions.Logging.Console
logger is very basic, with a hard-coded format that writes parts of a single event in different lines. It can't be customised and isn't meant to - it's only meant to be the most basic default. Serilog's Console provider offers extensive customisation but why use the console when you can already send events to StackDriver?
这确实解决了最初的问题,根据 Kiramm@:
I removed the default console logger and added Google's logger factory and the Stackdriver started interpreting log entries severity correctly