[英].NetCore log output wrong severity in GCP Stackdriver
The default log entry of a .netcore app is being written to the stdout and interpreted by the GCP Stackdriver as an info message, even if it is an error . .netcore 应用程序的默认日志条目被写入标准输出,并由 GCP Stackdriver 解释为信息消息,即使它是错误的。 Is there a way to write .netcore errors to the stderr or configure them somehow so that Stackdriver will interpret them as errors?
有没有办法将 .netcore 错误写入 stderr 或以某种方式配置它们,以便 Stackdriver 将它们解释为错误?
per Panagiotis Kanavos@:根据 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.Microsoft.Extensions.Logging.Console
记录器非常基础,采用硬编码格式将单个事件的各个部分写入不同的行。 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?
Serilog的控制台提供程序提供了广泛的自定义,但是当您已经可以将事件发送到 StackDriver 时,为什么还要使用控制台呢?
This did solved the original issue, per Kiramm@:根据 Kiramm@,这确实解决了最初的问题:
I removed the default console logger and added Google's logger factory and the Stackdriver started interpreting log entries severity correctly
我删除了默认的控制台记录器并添加了谷歌的记录器工厂,并且 Stackdriver 开始正确解释日志条目的严重性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.