ASP.NET Core Serilog至loggly不显示JSON属性
我们的应用程序使用serilog nuget软件包将日志写入loggly,我正在使用globallogcontext
添加这样的自定义属性:
using (GlobalLogContext.PushProperty("TransactionActivityId", activityId))
{
_logger.LogInformation("Test log message");
}
进行logger设置了logger
.UseSerilog((context, loggerConfiguration) => loggerConfiguration
.ReadFrom.Configuration(context.Configuration)
.Enrich.FromGlobalLogContext())
我们还通过在loggly中 “原始消息”部分,但自定义属性未显示在JSON部分中。
为了使loggly在JSON部分中显示此属性必须做什么?
Our application uses the Serilog NuGet package to write logs to Loggly, and I am using GlobalLogContext
to add a custom property like this:
using (GlobalLogContext.PushProperty("TransactionActivityId", activityId))
{
_logger.LogInformation("Test log message");
}
We also set up the logger by doing
.UseSerilog((context, loggerConfiguration) => loggerConfiguration
.ReadFrom.Configuration(context.Configuration)
.Enrich.FromGlobalLogContext())
In Loggly, I see the property in the "raw message" section, but the custom property is not showing up in the json section.
What has to be done in order for Loggly to show this property in the json section?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论