我有一个 Enterprise Logging 编程配置,如下所示:
builder.ConfigureLogging()
.LogToCategoryNamed("General")
.WithOptions.SetAsDefaultCategory()
.SendTo.RollingFile("Rolling Flat File Trace Listener")
.CleanUpArchivedFilesWhenMoreThan(7)
.WhenRollFileExists(RollFileExistsBehavior.Increment)
.WithTraceOptions(TraceOptions.Timestamp)
.RollEvery(RollInterval.Day)
.UseTimeStampPattern("yyyy-mm-dd")
.ToFile(logPath)
.FormatWith(
new FormatterBuilder()
.TextFormatterNamed("Text Formatter")
.UsingTemplate("{timestamp}:{title}:{message}"))
.WithFooter("").WithHeader("");
而且我没有看到滚动行为,但偶尔会看到日志文件损坏。有人有任何建议/想法吗?