Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Defer logger creation to allow custom logging configuration #129

Merged
merged 2 commits into from
Jul 25, 2017

Conversation

SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented Apr 28, 2017

this change c591c75

added the line ILog Log = LogManager.GetLogger<WindowsHost>();

This line will execute prior to the logging being configured by the user and result in a incorrect log log file created as described here https://groups.google.com/forum/#!topic/particularsoftware/7QK15QEMV4E

This PR defers the log creation until after the user has a chance to configure it

@ramonsmits ramonsmits changed the title defer logger creation Defer logger creation 7.0.x Apr 28, 2017
Copy link
Member

@ramonsmits ramonsmits left a comment

Choose a reason for hiding this comment

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

@SimonCropp @seanfarmar No real blockers. Should be backport this? As basically https://github.com/Particular/NServiceBus.Host/tree/hotfix-6.0.1 introduced this bug. It is not critical so based on our policy we shouldn't but personally it feels we should.

@@ -32,9 +31,10 @@ public void Start()
{
genericHost.Start().GetAwaiter().GetResult();
}
catch (Exception ex)
catch (Exception exception)
Copy link
Member

Choose a reason for hiding this comment

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

Is that our naming convention or is this personal style?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

descriptive variable names FTW

Copy link
Member

Choose a reason for hiding this comment

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

Not against that in general but I tend to not apply refactorings in patches to keep diffs as clean as possible.

{
Log.Fatal("Start failure", ex);
var log = LogManager.GetLogger<WindowsHost>();
Copy link
Member

Choose a reason for hiding this comment

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

Shall we add a comment to prevent someone refactoring this back to a field?

@SimonCropp
Copy link
Contributor Author

i dont think it needs to be back ported

@ramonsmits ramonsmits added this to the 7.0.2 milestone Apr 28, 2017
@ramonsmits ramonsmits changed the title Defer logger creation 7.0.x Defer logger creation to allow custom logging configuration Apr 28, 2017
@seanfarmar
Copy link
Contributor

Ok to merge this?

@SimonCropp
Copy link
Contributor Author

if you have released 7.0.2

@SimonCropp
Copy link
Contributor Author

@Particular/host-maintainers any update?

@ramonsmits ramonsmits self-assigned this Jul 24, 2017
@ramonsmits
Copy link
Member

@SimonCropp Still needs to be released. I'll do my best to release this Tomorrow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants