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

LoggingConfiguration - ValidateConfig should only throw when enabled #4102

Merged

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Aug 29, 2020

Trying to resolve #4099

For some reason then NLog has always thrown exceptions on missing / invalid required-parameters. Independent of throwException or throwConfigException.

I think NLog should continue even if having loaded invalid config (Logging should not break the host application).

Have adjusted the validation logic so it is expected that objects that implements ISupportsInitialize will implicit call CheckRequiredParameters. This ensures that Target-objects will become disabled and not call InitializeTarget (Just like now).

This has the side-effect that Layouts and LayoutRenderers will now also call CheckRequiredParameters when created and used outside the context of the LoggingConfiguration. Think this is an improvement.

@snakefoot snakefoot added the enhancement Improvement on existing feature label Aug 29, 2020
@snakefoot snakefoot added this to the 4.7.5 milestone Aug 29, 2020
@snakefoot snakefoot force-pushed the MissingRequiredParameterShouldNotThrow branch 6 times, most recently from 40f8393 to 0ff1b5b Compare August 29, 2020 09:55
@snakefoot snakefoot force-pushed the MissingRequiredParameterShouldNotThrow branch from 0ff1b5b to 94de02a Compare August 29, 2020 10:16
@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 29, 2020
Copy link
Member

@304NotModified 304NotModified left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good!

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

63.6% 63.6% Coverage
0.0% 0.0% Duplication

@304NotModified 304NotModified merged commit c45d259 into NLog:master Aug 29, 2020
@snakefoot snakefoot deleted the MissingRequiredParameterShouldNotThrow branch July 30, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement on existing feature size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants