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

Extend example to include support for Lifetime Startup Messages #615

Closed
snakefoot opened this issue Dec 14, 2020 · 1 comment · Fixed by #621
Closed

Extend example to include support for Lifetime Startup Messages #615

snakefoot opened this issue Dec 14, 2020 · 1 comment · Fixed by #621
Labels

Comments

@snakefoot
Copy link
Contributor

We have already recognized it is important to perform logging of Lifetime Startup Messages:

https://github.com/NLog/NLog.Web/wiki/Hosting-Lifetime-Startup-Messages

But the example code is this:

      .ConfigureLogging(logging =>
      {
          logging.ClearProviders();   // Removes the default console-logger
          logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
      })

And the Nlog.config contains these rules:

  <rules>
    <!--All logs, including from Microsoft-->
    <logger name="*" minlevel="Trace" writeTo="allfile" />

    <!--Skip non-critical Microsoft logs and so log only own logs-->
    <logger name="Microsoft.*" maxlevel="Info" final="true" /> <!-- BlackHole without writeTo -->
    <logger name="*" minlevel="Trace" writeTo="ownFile-web" />
  </rules>

Maybe ConsoleTarget with Microsoft-Logger should be added to NLog.config in the tutorial, so Lifetime Startup Messages will work out of the box with NLog.

@snakefoot snakefoot added the docs label Dec 14, 2020
@304NotModified
Copy link
Member

Good idea :)

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

Successfully merging a pull request may close this issue.

2 participants