Conversation
Codecov Report
@@ Coverage Diff @@
## dev #3048 +/- ##
======================================
- Coverage 80% 80% -<1%
======================================
Files 349 349
Lines 27549 27549
Branches 3654 3654
======================================
- Hits 21914 21903 -11
- Misses 4583 4596 +13
+ Partials 1052 1050 -2 |
304NotModified
left a comment
There was a problem hiding this comment.
prefer testing the global mutex, before disabling it
I prefer not throwing exceptions as part of normal operation. The Also the Also notice that |
Me neither, but there isn't a property to check. So I this case I think it's a better option than changing the default for all. Also note that frameworks like MVC also throw exceptions under the hood in normal operation. Last but not least, we are preventing a exception in this case (the mutex not available exception) |
Well I think it is a better default to have |
We could detect that (try-catch) and that isn't difficult? I don't like to move to default false, if there isn't another option. IMO smart defaults (detect it) are much better defaults than a black-white choice. |
|
The default is KeepFileOpen = false. No need to have ConcurrentWrites = true also. Think ConcurrentWrites = true is a bad default for all platforms (But hard to ignore old NetFramework IIS applications).
|
dd2f3f7 to
95d98f9
Compare
|
@304NotModified For NLog 5.0 as it is a minor breaking change. |
Well if you look at #2742 then the attempt of using the mutex takes down the application (UWP NetNative) Still think that NetCore should have It will give the highest compatibility and the best performance on the NetCore-platform. IIS-users will not be affected as they will be using legacy Net45. |
I'm not sure if that's true |
Please explain how changing the default for NetCore will affect legacy Net45 applications? |
|
I mean, IIS users aren't limited to non core .NET (I think) |
You mean the new https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2 Looks like one have to wait for NetCore 3.0 to know the final level of isolation. (Still BETA mode for NetCore2.2) But until now it has been one process/appdomain for one website on NetCore. For legacy IIS then it is possible to spin up an extra AppDomain for the same website. This extra AppDomain for the same website required across-AppDomain file-synchronization. |
|
I think we should disable it for all platforms, or none. What is the performance gain when ConcurrentWrites=false? |
|
From #3490 then:
But I guess this is with atomic-file-appender, and not with forceManaged=true. I'm guessing it will be like this:
So for NetCore then ConcurrentWrites=false will be 4 times faster and more compatible from the start. |
;)
I think it's more important to compare when KeepFileOpen=false (the default). |
|
I think there are 3 audiences for NLog.
I think it's more important to to focus on 1 and 2. If we focus on 3, that could hurt 1 and 2. That we will lose on 3 is really pity (I've seen comparisons before) - but that is an explicit choice. |
When using Should rename these parameters:
And change this line: Into: if ((!CreateFileParameters.ConcurrentWrites && !CreateFileParameters.KeepFileOpen) || i + 1 == CreateFileParameters.FileOpenRetryCount) |
|
My priority is this:
So I don't mind that KeepFileOpen=false by default (Though not a great default for performance). But I do mind that ConcurrentWrites=true is enabled by default as it hurts performance and give compatibility issues with KeepFileOpen=true. |
|
so could we set ConcurrentWrites to false when unset and KeepFileOpen=true? (sorry if this is proposed before) |
Same as having ConcurrentWrites=false by default. And perform the above rename of parameters (FileOpenRetryCount + FileOpenRetryDelay) so they apply for both ConcurrentWrites=true and KeepFileOpen=false. When using KeepFileOpen=false with ConcurrentWrites=true with archiving enabled, then it will create the archive mutex. |
Then you should also have And if you notice the code in this PR, then I have given |
|
Kudos, SonarCloud Quality Gate passed!
|
bd5c520 to
e93fd6a
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
Think this belongs to NLog 5.0, since the goal is to make NLog to be more slim and work on more platforms out-of-the-box (UWP and Xamarin Platforms without access to global operation resources like mutex, as they live in sandbox). Especially because NLog 5.0 drops Xamarin Android an iOS platforms (that never used global mutex before), and will most likely fail when using NetStandard FileTarget unless ConcurrentWrites is disabled. |
e93fd6a to
fb7606d
Compare
|
Kudos, SonarCloud Quality Gate passed! |
|
Updated wiki: https://github.com/NLog/NLog/wiki/File-target |
See also #2742 and #2824 and #2925 and #3059 (Xamarin mobile platforms also don't like global mutex) and #3893
This change is