简体   繁体   English

Serilog在可靠的Actor服务中不起作用

[英]Serilog doesn't work in Reliable Actor Services

I have two Service Fabric application. 我有两个Service Fabric应用程序。 The first is an Asp.Net Core Service Fabric, the second is an Actor Service that run with timer. 第一个是Asp.Net核心服务结构,第二个是使用计时器运行的Actor服务。

Both are set up with Serilog. 两者都使用Serilog进行设置。 The Asp.Net Core work very well. Asp.Net核心工作得很好。 no problem there, but the second service, Actor Service, I use the same configurations and same nuget packages but Serilog doesn't save any log. 那里没问题,但是第二项服务,Actor服务,我使用相同的配置和相同的nuget包,但Serilog不会保存任何日志。

Add Config 添加配置

<add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
    <add key="serilog:write-to:Seq.serverUrl" value="http://*****" />
    <add key="serilog:write-to:Seq.apiKey" value="UfKpKLicyZI3hGe7Vc" />
    <add key="serilog:using:RollingFile" value="Serilog.Sinks.RollingFile" />
    <add key="serilog:write-to:RollingFile.pathFormat" value="C:\File-{Date}.txt" />
    <add key="serilog:write-to:RollingFile.retainedFileCountLimit" value="10" />

这里最可能的原因是,在托管角色的进程关闭之前,Serilog Logger未被Dispose() d(如果要设置静态Log类而不是直接使用logger实例,则可以通过Log.CloseAndFlush()来实现Log.CloseAndFlush() )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM