NLog.Targets.GZipFile - Improve support for ArchiveAboveSize#5911
NLog.Targets.GZipFile - Improve support for ArchiveAboveSize#5911
Conversation
WalkthroughThe changes introduce improved handling and testing of file archiving based on file size in NLog targets, particularly refining conditions for archiving, optimizing archive sequence logic, and enhancing debug logging. Test coverage is expanded for GZip file archiving scenarios, and some method signatures and obsolete messages are updated for clarity and consistency. Changes
Sequence Diagram(s)sequenceDiagram
participant Logger
participant FileTarget
participant ArchiveHandler
participant FileSystem
Logger->>FileTarget: Log event
FileTarget->>FileSystem: Write to file
FileTarget->>ArchiveHandler: Check if archive needed (ArchiveAboveSize > 0)
alt File size exceeds ArchiveAboveSize
ArchiveHandler->>FileSystem: Archive file (roll file)
FileTarget->>FileSystem: Write to new file
else File size below threshold
FileTarget->>FileSystem: Continue writing
end
sequenceDiagram
participant Test
participant GZipFileTarget
participant FileSystem
Test->>GZipFileTarget: Configure with ArchiveAboveSize
Test->>GZipFileTarget: Write log entries
GZipFileTarget->>FileSystem: Write/Archive files as needed
Test->>FileSystem: Verify content of original and archived files
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (5)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
53fa62f to
b938233
Compare
762571b to
c88f3ad
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/NLog/Targets/ConsoleTarget.cs(1 hunks)src/NLog/Targets/FileAppenders/ExclusiveFileLockingAppender.cs(4 hunks)src/NLog/Targets/FileArchiveHandlers/BaseFileArchiveHandler.cs(3 hunks)src/NLog/Targets/FileArchiveHandlers/RollingArchiveFileHandler.cs(3 hunks)src/NLog/Targets/FileTarget.cs(2 hunks)tests/NLog.UnitTests/Targets/FileTargetTests.cs(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- src/NLog/Targets/ConsoleTarget.cs
- src/NLog/Targets/FileTarget.cs
- src/NLog/Targets/FileArchiveHandlers/RollingArchiveFileHandler.cs
- src/NLog/Targets/FileAppenders/ExclusiveFileLockingAppender.cs
- tests/NLog.UnitTests/Targets/FileTargetTests.cs
🔇 Additional comments (2)
src/NLog/Targets/FileArchiveHandlers/BaseFileArchiveHandler.cs (2)
58-58: Method call updated correctly for the rename.The method call has been properly updated to use the renamed method
GetDeleteOldFileNameWildcard.
273-273: Method renamed to better reflect its purpose.The method name change from
GetFileNameWildcardtoGetDeleteOldFileNameWildcardis more descriptive and clearly indicates its specific use case for deletion operations.
|



Trying to resolve #5910 - Followup to #5783