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

Issue #987: Filetarget: Max archives settings sometimes removes to many files #1019

Merged
merged 3 commits into from Nov 8, 2015

Conversation

bhaeussermann
Copy link
Contributor

Fixes #987 basically by fixing the order of the actions:

  • Do auto-archive before deleting old archives (this way when there's a new archive, this new archive is accounted for when deleting old archives)
  • During archive: Call RollArchiveForward() before EnsureArchiveCount()

@304NotModified
Copy link
Member

Thanks!

Any idea why appveyor complains?

@304NotModified 304NotModified added the bug Bug report / Bug fix label Nov 7, 2015
@bhaeussermann
Copy link
Contributor Author

So ThreadSafe_getCurrentClassLogger_test fails. That's strange. The test passes on my side and I didn't touch LogManager.

@304NotModified
Copy link
Member

I will rerun the build. Some tests aren't robust, but I haven't seen failing this test before.

Note: I also tried to remove the (directorynotfound) try-catch before, but then also some tests failed.

Some really good renames and small improvements in code, I'm impressed!

@codecov-io
Copy link

Current coverage is 71.86%

Merging #1019 into master will decrease coverage by -0.09% as of f20288e

@@            master   #1019   diff @@
======================================
  Files          263     263       
  Stmts        14829   14827     -2
  Branches      1610    1612     +2
  Methods          0       0       
======================================
- Hit          10670   10655    -15
+ Partial        420     418     -2
- Missed        3739    3754    +15

Review entire Coverage Diff as of f20288e


Uncovered Suggestions

  1. +0.08% via ...argets/FileTarget.cs#1918...1930
  2. +0.08% via ...argets/FileTarget.cs#1555...1567
  3. +0.08% via ...c/NLog/LogFactory.cs#180...191
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@304NotModified
Copy link
Member

This seems another issue, I fix that one in another PR.

@304NotModified 304NotModified added this to the 4.2.1 milestone Nov 8, 2015
@304NotModified
Copy link
Member

We lost coverage by removing an unit test?

@bhaeussermann
Copy link
Contributor Author

We lost coverage by removing an unit test?

I changed the MaxArchiveFilesWithDate() test helper method to always do an exact compare instead of lower-or-equals by removing the exactArchiveTest parameter.
After this change, the TestMaxArchiveFilesWithDate test had made exactly the same call to MaxArchiveFilesWithDate() than MaxArchiveFilesWithDate_removesToManyFiles, making the latter test superfluous. Hence I removed that test. Both tests invoked the same code, so the code coverage should not be affected by this.

Judging by the code coverage diff, it appears that all added code is covered by the tests.

I would attribute the drop in coverage percentage to the fact that the number of statements in FileTarget has decreased (58 additions & 62 deletions in the main commit). What do you think?

@304NotModified
Copy link
Member

I think your right! Thanks for checking!

304NotModified added a commit that referenced this pull request Nov 8, 2015
Issue #987: Filetarget: Max archives settings sometimes removes to many files
@304NotModified 304NotModified merged commit 71b606b into NLog:master Nov 8, 2015
@304NotModified 304NotModified added the file-archiving Issues with archiving with the file target label Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report / Bug fix file-archiving Issues with archiving with the file target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants