Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for codeplex issue 6575 #8

Closed
wants to merge 1 commit into from
Closed

Fix for codeplex issue 6575 #8

wants to merge 1 commit into from

Conversation

ParthDesai
Copy link
Contributor

This fix inject the pattern in the archive file name pattern so that even if user do not provide pattern in file name , code will inject it.

How the archiving is done is depend on three variables :
ArchiveEvery : Specifies Time period
ArchiveAboveSize : Specifies size
MaxArchiveFiles : Specifies maximum archived files to keep.

There are three cases mainly :

(1) Lets say developer has set ArchiveEvery to hour and ArchiveAboveSize to 10 MB
So , Whatever condition occurs first , then NLog will start archiving the current log file , in this case numbering is required otherwise NLog will overwrite the previous archive file.

(2) Lets say developer has set ArchiveEvery to none (default) and ArchiveAboveSize to 10 MB
So , in this case if the current log file's size is going to increase above 10 MB , then it will move this file to archive and create a new log file , in this case also we require numbering. Otherwise NLog will overwrite the previous file that was created when the size first increased.

(3) Lets say developer has set ArchiveEvery to hour and ArchiveAboveSize to -1(default)
So , in this case if the hour passed then regardless of the size of the log file , it will be moved to the archive . So , numbering is required. So After second hour if NLog archive the file then it should not overwrite the file that was created after completion of first hour.So , Numbering is required.

In all cases Numbering is required , because NLog will archive file upto MaxArchiveFiles specified.and We don't want to overwrite them.

This fix inject the pattern in the archive file name pattern so that even if user do not provide pattern in file name , code will inject it.
@ghost
Copy link

ghost commented Sep 27, 2012

The cases you mention requires numbering, but the case the bug report referes to doesn't. I'm not saying that you fix is incorrect, I'm just not sure this is the solution we want.
Another solution could be to require the numbering part in the filename.

@ParthDesai
Copy link
Contributor Author

ok, I will reconsider my fix. And will try to improve.

@ParthDesai ParthDesai closed this Sep 27, 2012
304NotModified added a commit that referenced this pull request Mar 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant