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

LogFactory - Fixed EventArgs for ConfigurationChanged #1897

Merged

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Jan 10, 2017

Fixes the issue #1122 with the breaking change introduced with NLog ver. 4 for LoggingConfigurationChangedEventArgs. See also #491

This marks the broken OldConfiguration and NewConfiguration as obsolete, and instead introduces two new properties:

  • ActivatedConfiguration
  • DeactivatedConfiguration

No source breaking change, and no binary breaking change. Just obsolete warnings and new properties.

@codecov-io
Copy link

codecov-io commented Jan 10, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@3323d6f). Click here to learn what that means.
The diff coverage is 71%.

@@           Coverage Diff            @@
##             master   #1897   +/-   ##
========================================
  Coverage          ?     82%           
========================================
  Files             ?     307           
  Lines             ?   21810           
  Branches          ?    2656           
========================================
  Hits              ?   17850           
  Misses            ?    3286           
  Partials          ?     674

@snakefoot snakefoot force-pushed the LogFactoryConfigurationChangedFlip2 branch from c743e4e to 429a748 Compare January 10, 2017 21:43
@snakefoot snakefoot changed the title LogFactory - Renamed ConfigurationChanged-event to ConfigurationReplaced LogFactory - Fixed LoggingConfigurationChangedEventArgs as breaking change Jan 10, 2017
@snakefoot snakefoot changed the title LogFactory - Fixed LoggingConfigurationChangedEventArgs as breaking change LogFactory - Fixed EventArgs for ConfigurationChanged Jan 10, 2017
@snakefoot snakefoot force-pushed the LogFactoryConfigurationChangedFlip2 branch 2 times, most recently from 7df36f6 to ff3bb11 Compare January 10, 2017 22:06
@@ -338,7 +338,7 @@ public LoggingConfiguration Configuration
}
}

this.OnConfigurationChanged(new LoggingConfigurationChangedEventArgs(value, oldConfig));
this.OnConfigurationChanged(new LoggingConfigurationChangedEventArgs(oldConfig, value));
Copy link
Member

Choose a reason for hiding this comment

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

so this is still a breaking change.

I like to resolve this issue, but if it's breaking, it should be NLog 5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it is not a breaking change as I have "fixed" the now obsolete properties for LoggingConfigurationChangedEventArgs. Guess it should wait for NLog 4.5 because of the obsolete handling

Copy link
Member

Choose a reason for hiding this comment

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

If I call new LoggingConfigurationChangedEventArgs(value, oldConfig) after this PR has been merged, then it has a different behavior? Or am I missing something :)

@304NotModified 304NotModified added the breaking change Breaking API change (different to semantic change) label Jan 11, 2017
@304NotModified 304NotModified added this to the 5.0 milestone Jan 11, 2017
@304NotModified
Copy link
Member

Not sure if there is a real benefit to introduce a breaking change which isn't really needed (even if it's NLog 5)

@snakefoot
Copy link
Contributor Author

Well it fooled me, as I tried to add a configuration-changed event handler for the unit-tests, where I enabled throw-exceptions for all loaded configurations. Sadly enough it never worked, because I actually enabled it for the old-configuration. Others also think this is weird as you can see with #1122

@304NotModified
Copy link
Member

Others also think this is weird as you can see with #1122

yes could't agree more.

Sadly enough it never worked, because I actually enabled it for the old-configuration.

and after this change. it could "magically" won't work for others am I afraid of.

@snakefoot snakefoot force-pushed the LogFactoryConfigurationChangedFlip2 branch from ff3bb11 to 4c06a77 Compare January 11, 2017 23:00
@snakefoot
Copy link
Contributor Author

You are right. People who allocates the NLog LoggingConfigurationChangedEventArgs for use elsewhere will get a breaking change. I have updated the PR.

@snakefoot
Copy link
Contributor Author

snakefoot commented Jul 19, 2017

@304NotModified This is actually not a breaking change. It just introduces new properties and marks the old ones as obsolete. There is no change between the constructor-input-parameters and the behavior of the obsolete properties.

…ration (Made faulty OldConfiguration and NewConfiguration obsolete)
@snakefoot snakefoot force-pushed the LogFactoryConfigurationChangedFlip2 branch from 4c06a77 to 4db35b5 Compare October 4, 2017 22:21
@snakefoot
Copy link
Contributor Author

snakefoot commented Oct 4, 2017

@304NotModified Can we have this PR included for NLog 4.5 as it is not a breaking change? Now just faulty properties marked as obsolete, and introduction of correctly working properties.

@304NotModified
Copy link
Member

isn't the breaking change here the reordered parameters in the ctor?

@snakefoot
Copy link
Contributor Author

snakefoot commented Oct 5, 2017

isn't the breaking change here the reordered parameters in the ctor?

How are the parameters re-ordered? Since NLog 4.0 broke LoggingConfigurationChangedEventArgs, then the first parameter has become the new active configuration. The obsolete (and faulty) OldConfiguration makes sure to return the first parameter (new active configuration).

@304NotModified
Copy link
Member

new LoggingConfigurationChangedEventArgs(old, new) needs to be new LoggingConfigurationChangedEventArgs(new,old) after this change?

@snakefoot
Copy link
Contributor Author

snakefoot commented Oct 5, 2017

new LoggingConfigurationChangedEventArgs(old, new) needs to be new LoggingConfigurationChangedEventArgs(new,old) after this change?

No matter what then NLog ver 3 users will feel the punishment of the NLog 4 breaking change.

In NLog 4 the first parameter has always been the new active configuration, it was just named wrong in the documentation. I have just fixed the documentation.

@304NotModified
Copy link
Member

In NLog 4 the first parameter has always been the new active configuration, it was just named wrong in the documentation

Ah, indeed, missed that.

@304NotModified 304NotModified added bug Bug report / Bug fix and removed breaking change Breaking API change (different to semantic change) discussion labels Oct 5, 2017
@304NotModified 304NotModified modified the milestones: 5.0, 4.5 Oct 5, 2017
@304NotModified 304NotModified merged commit e339b80 into NLog:master Oct 5, 2017
@304NotModified
Copy link
Member

merged!

@304NotModified 304NotModified modified the milestones: 4.5, 4.5 beta 4 Oct 10, 2017
@snakefoot snakefoot deleted the LogFactoryConfigurationChangedFlip2 branch October 10, 2017 20:37
@snakefoot snakefoot mentioned this pull request Nov 23, 2017
@snakefoot snakefoot modified the milestones: 4.5 beta 4, 4.5 Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report / Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants