dotnet / dotnet/aspnetcore

FileLoggerProcessor should update FileNumber suffix when FileName changes

Open
#34,809 1 comment 0 reactions 0 assignees View on GitHub
area-middleware feature-http-logging
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

https://github.com/dotnet/aspnetcore/blob/eb0f414830a5468d0fba0c885b0a9ed0227292f0/src/Middleware/HttpLogging/src/W3CLoggerOptions.cs#L17

When FileName changes, we should reset FileNumber back to 0 instead of continuing where we left off.

https://github.com/dotnet/aspnetcore/blob/eb0f414830a5468d0fba0c885b0a9ed0227292f0/src/Middleware/HttpLogging/src/FileLoggerProcessor.cs#L65-L80

> 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.