-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-http-logging
Milestone
Description
| private string _fileName = "w3clog-"; |
When FileName changes, we should reset FileNumber back to 0 instead of continuing where we left off.
aspnetcore/src/Middleware/HttpLogging/src/FileLoggerProcessor.cs
Lines 65 to 80 in eb0f414
| _options.OnChange(options => | |
| { | |
| lock (_pathLock) | |
| { | |
| // Clear the cached settings. | |
| loggerOptions = options; | |
| if (!string.IsNullOrEmpty(loggerOptions.LogDirectory)) | |
| { | |
| _path = loggerOptions.LogDirectory; | |
| } | |
| _fileName = loggerOptions.FileName; | |
| _maxFileSize = loggerOptions.FileSizeLimit; | |
| _maxRetainedFiles = loggerOptions.RetainedFileCountLimit; | |
| _flushInterval = loggerOptions.FlushInterval; | |
| } | |
| }); |
But it might be somewhat tricky - e.g. OnChange fires in the middle of execution of WriteMessagesAsync, causing the FileNumber to go back to zero. If this happens while we're scanning through some previous files to find out if they exist, it could cause us to suffix the first file with the new name with something nonzero. I'll file a follow-up issue for this one, for now I think it's fine if the numbering for the new file names pick up where the old ones left off.
Metadata
Metadata
Assignees
Labels
area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresfeature-http-logging