-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
waiting on upstreamAN upstream issue needs to be resolvedAN upstream issue needs to be resolved
Description
A Header is being incorrectly added to a log file at exactly 30 min intervals when Serilog is configured to roll a log file when reaching a file size limit. Our Serilog initialisation code is shown below:
// Assemble the file header that's written when the log is created and repeated at the top of each log file. header.AppendLine(new string('*', 120)); header.AppendLine(string.Format("Application started at {0} {1}", startTime.ToShortDateString(), startTime.ToShortTimeString())); header.AppendLine(String.Format("Executable: {0}. Version {1}.{2} Build {3}.", System.Reflection.Assembly.GetExecutingAssembly().Location, System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileMajorPart, System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileMinorPart, System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileBuildPart)); header.AppendFormat("Environment: Host = '{0}'; Operating System = '{1}', Region = '{2}'; Installed UI Culture = '{3}'.", Environment.MachineName, Environment.OSVersion, culture.EnglishName, culture.Name);
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.Enrich.WithThreadId()
.Enrich.WithThreadName()
.MinimumLevel.ControlledBy(levelSwitch)
.WriteTo.File(FileName,
buffered: false,
fileSizeLimitBytes: Size * 1048576, // Convert to Bytes
retainedFileCountLimit: Retain,
rollOnFileSizeLimit: true,
outputTemplate: "{Timestamp:dd/MM/yyyy HH:mm:ss.fff} {Level:u3} [{ThreadId} {ThreadName}] {Message:lj}{NewLine}{Exception}",
hooks: new HeaderWriter(header.ToString,true))
.CreateLogger();
Metadata
Metadata
Assignees
Labels
waiting on upstreamAN upstream issue needs to be resolvedAN upstream issue needs to be resolved