seq 日志系统
    # 设置 
    # 这里使用了 Microsoft.Extensions.Logging
    var data = new Dictionary<string, string?>();
    data["Seq:ServerUrl"] = "http://xxxxx:xxx"; // api 地址 (注:与 ui 端口不一致 )
    data["Seq:ApiKey"] = "otyNuHUy68RFwGtMMGNs"; // api key
    data["Seq:MinimumLevel"] = "Trace"; // 默认 Information  
    data["Seq:LevelOverride:Microsoft"] = "Warning"; 
    var configuration = new ConfigurationBuilder().AddInMemoryCollection(data).Build();

    builder.Services.AddLogging( builder => builder.AddSeq(configuration.GetSection("Seq")));

    # 正常调用即可
    logger.LogTrace($"我是 LogTrace {currentTime}" );
    logger.LogDebug($"我是 LogDebug {currentTime}");
    logger.LogInformation($"我是 LogInformation {currentTime}");
    logger.LogWarning($"我是 LogWarning {currentTime}");
    logger.LogError($"我是 LogError {currentTime}");
    logger.LogCritical($"我是 LogCritical {currentTime}");

    # 自动删除日志
    后台 settings/retention 指定删除多久前的日志

引用

https://www.cnblogs.com/kklldog/p/netcore-with-microservices-05.html
https://blog.csdn.net/weixin_37648525/article/details/124791042
https://docs.datalust.co/docs/the-seq-query-language

搜索语法

上一篇
下一篇