You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
The text was updated successfully, but these errors were encountered:
I've been able to replicate this. As I thought, it's an issue in the Serilog File Sink, rather than this extension - I'll go ahead and open an issue in that repo, linking it back to here.
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:
The text was updated successfully, but these errors were encountered: