servicestack 和 Serilog 无法正常工作

servicestack and Serilog not working properly

我无法在服务堆栈中成功实现登录。我在这里和 serilog GIT 上发帖。 Serilog 团队认为这是一个服务堆栈问题。如果您想访问我的项目,请告诉我。

https://github.com/serilog/serilog/issues/1267

Cannot deconstruct object into Json serilog and Servicestack IReturn

我也在从我的基站调用该服务 class

public class ServiceBase: Service
    {
        /// <summary>
        /// Examples
        /// ILog.Debug(Exception ex, string messageTemplate, params object[] propertyValues)
        /// ILog.Info(Exception ex, string messageTemplate, params object[] propertyValues)
        /// ILog.Warn(Exception ex, string messageTemplate, params object[] propertyValues)
        /// ILog.Error(Exception ex, string messageTemplate, params object[] propertyValues)
        /// ILog.Fatal(Exception ex, string messageTemplate, params object[] propertyValues)
        /// ILog.ForContext(Type type)
        /// ILog.ForContext<T>()
        /// ILog.ForContext(ILogEventEnricher enricher)
        /// ILog.ForContext(IEnumerable<ILogEventEnricher> enrichers)
        /// ILog.ForContext(string propertyName, object value, bool destructureObjects = false)
        /// </summary>
        public ILog Log = LogManager.GetLogger(typeof(ServiceBase));

我找到了答案。您需要在 app.UseServiceStack(new AppHost {AppSettings = new NetCoreAppSettings(Configuration)});

之后初始化记录器

Answer