Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FileTarget: Fix archive based on time does not always archive. - #1100

#1100
Merged
304NotModified merged 11 commits into
NLog:masterNLog/NLog:masterfrom
bhaeussermann:branch0bhaeussermann/NLog:branch0Copy head branch name to clipboard
Dec 26, 2015
Merged

FileTarget: Fix archive based on time does not always archive.#1100
304NotModified merged 11 commits into
NLog:masterNLog/NLog:masterfrom
bhaeussermann:branch0bhaeussermann/NLog:branch0Copy head branch name to clipboard

Conversation

@bhaeussermann

Copy link
Copy Markdown
Contributor

Fixes #1022,fix #859, fix #550

@304NotModified

Copy link
Copy Markdown
Member

Thanks! Is this (partly) the same as #1090?

@bhaeussermann

Copy link
Copy Markdown
Contributor Author

Thanks! Is this (partly) the same as #1090?

Yes. It's basically the same, except I retained the lastWriteTime parameter of the GetFileInfo() method. I'm not convinced that it is correct to use creationTime instead of lastWriteTime in IsDaySwitch() (as in #1090), but I will investigate.

@304NotModified

Copy link
Copy Markdown
Member

Well we can now unit test it, isn't it?

Thanks for checking :)

@304NotModified

Copy link
Copy Markdown
Member

I'm not convinced that it is correct to use creationTime instead of lastWriteTime in IsDaySwitch() (as in #1090), but I will investigate.

I think creationTime is better, but please check.

Can you also check the mono error? Thanks!

@bhaeussermann

Copy link
Copy Markdown
Contributor Author

I think creationTime is better, but please check.

It seems you are right, and I supplemented the tests to enforce this.

And with that, it seems that we never use the lastWriteTime parameter of the GetFileInfo() method. Do you think we should remove this parameter (as in #1090), or keep it for now in case we need it again?

I'm also thinking about refactoring the GetFileInfo() method by replacing all the out parameters with a single out FileInfo parameter (FileInfo being a new class). This should decrease the number of changes when we need to change what file info the GetFileInfo() method returns. What do you think?

@304NotModified

Copy link
Copy Markdown
Member

It seems you are right, and I supplemented the tests to enforce this.

Thanks!

And with that, it seems that we never use the lastWriteTime parameter of the GetFileInfo() method. Do you think we should remove this parameter (as in #1090), or keep it for now in case we need it again?

Remove it. Less is more (and dead code which isn't clearly dead, is a source of confusion).

I'm also thinking about refactoring the GetFileInfo() method by replacing all the out parameters with a single out FileInfo parameter (FileInfo being a new class). This should decrease the number of changes when we need to change what file info the GetFileInfo() method returns. What do you think?

That's a good proposal. But please don't name it FileInfo. I was already confused before that it wasn't returning a FileInfo instance (the well known BCL FileInfo). Maybe something like FileMetaInfo? (and rename the method)

@codecov-io

Copy link
Copy Markdown

Current coverage is 73.19%

Merging #1100 into master will decrease coverage by -0.05% as of 3e7e056

@@            master   #1100   diff @@
======================================
  Files          263     264     +1
  Stmts        14972   14928    -44
  Branches      1637    1636     -1
  Methods          0       0       
======================================
- Hit          10966   10927    -39
+ Partial        420     419     -1
+ Missed        3586    3582     -4

Review entire Coverage Diff as of 3e7e056


Uncovered Suggestions

  1. +0.09% via ...nternal/AspHelper.cs#206...218
  2. +0.09% via ...nternal/AspHelper.cs#188...200
  3. +0.09% via ...nternal/AspHelper.cs#170...182
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! But why it's still a out parameter? We can refactor the whole tree because it's internal?

@304NotModified

Copy link
Copy Markdown
Member

Added some small notes.

PS. If you like, please rename some vars to meaningful names. "fi", "ts", those should be removed in the code (in the future)

@304NotModified 304NotModified added this to the 4.3 milestone Dec 26, 2015
@304NotModified 304NotModified added bug Bug report / Bug fix enhancement Improvement on existing feature labels Dec 26, 2015
@304NotModified

Copy link
Copy Markdown
Member

Thanks! Great job!

PS I only get a notification if you post a comment.

304NotModified added a commit that referenced this pull request Dec 26, 2015
FileTarget: Fix archive based on time does not always archive.
@304NotModified
304NotModified merged commit 7b696ae into NLog:master Dec 26, 2015
@304NotModified

Copy link
Copy Markdown
Member

Any idea if this also fixes #307?

@bhaeussermann

Copy link
Copy Markdown
Contributor Author

Any idea if this also fixes #307?

I don't think so. #307 looks like a threading issue. It does not look like it's due to wrong logic in ShouldAutoArchive(); I think the code is merely not thread-safe, which is not addressed in this PR.

@304NotModified

Copy link
Copy Markdown
Member

Any idea if this also fixes #307?

I don't think so. #307 looks like a threading issue. It does not look like it's due to wrong logic in ShouldAutoArchive(); I think the code is merely not thread-safe, which is not addressed in this PR.

I think you are right! Thanks for checking!

@ilya-g

ilya-g commented Jan 28, 2016

Copy link
Copy Markdown
Contributor

@bhaeussermann Have you considered making FileCharacteristics a structure? I'm a bit concerned about instantiating a class or two on every write to FileTarget, it may cause significant memory pressure.

@304NotModified

Copy link
Copy Markdown
Member

Hey @ilya-g! Good to see your here :)

You have a valid point although it's a short living object. @epignosisx what do you think of this? Can we profile the memory pressure on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug report / Bug fix enhancement Improvement on existing feature file-archiving Issues with archiving with the file target file-target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.