Aspnetcore.docs: EventLog logging configuration clarification

Created on 29 Jun 2020  Â·  6Comments  Â·  Source: dotnet/AspNetCore.Docs

In the section on windows event log, there is a sentence that reads:

If EventLog log settings are specified, they default to LogLevel.Warning.

Should this be:

If EventLog log settings are not specified, they default to LogLevel.Warning.

I am having an issue where the first statement is occurring.
I am specifying the LogLevel as Information, but it is still defaulting to Warning as per the documentation, which seems odd.

{
  "Logging": {
    "LogLevel": {
      "Default": "Debug"
    }
  },
  "EventLog": {
    "LogLevel": {
      "Default": "Information"
    }
  }
}

HostBuilder looks like this if it matters:

public static IHostBuilder CreateWebHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>()                       
                        .ConfigureLogging((hostingContext, logging) =>
                        {
                            logging.AddEventLog(options =>
                            {
                                options.SourceName = "ExampleApp";
                            });
                        })
                        .CaptureStartupErrors(true);
                });

Using core 3.1
Microsoft.Extensions.Logging.EventLog 3.1.5


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P0 Source - Docs.ms doc-bug

All 6 comments

Should this be:

If EventLog log settings are not specified, they default to LogLevel.Warning.

Yep, I think it should be _aren't_.

I am specifying the LogLevel as Information...

This isn't what you're doing, because you have EventLog in the wrong section. It should be this:

{
  "Logging": {
    "LogLevel": {
      "Default": "Debug"
    },
    "EventLog": {
      "LogLevel": {
        "Default": "Information"
      }
    }
  }
}

Note that EventLog is a _child_ of Logging; not a _sibling_.

@serpent5 Thank you for the correction on my config. That is working now.
What a coincidence that my mistake aligned with the typo!

@philip-reed, do you want to put the PR in to use "aren't," or do want one of us to do it?

I've not contributed before so would like the opportunity.

Leave it with me to figure out.

On Mon, 29 Jun 2020, 18:16 Luke Latham, notifications@github.com wrote:

@philip-reed https://github.com/philip-reed, do you want to put the PR
in to use "aren't," or do want one of us to do it?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/AspNetCore.Docs/issues/18997#issuecomment-651251927,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AB3P3H4TGHRIBW5HKPYMFCTRZDD7XANCNFSM4OLK2DZQ
.

Sure thing ... use the "Edit" (pencil) on the topic and follow the prompts to submit the change.

Be sure to search _the whole topic for multiple lines_ that might be wrong. We hold multiple versions of a topic in the same file. This sentence might appear two or more times. All instances that you find should be updated.

When you open the PR, put ...

Fixes #18997

... in the opening comment so that this issue will automatically close when the PR merges.

How's that?

Did it on my phone which was pretty cool.
Wasn't sure if should have updated the config example but figured if I got
it wrong then others might.

On Mon, 29 Jun 2020, 18:27 Luke Latham, notifications@github.com wrote:

Sure thing ... use the "Edit" (pencil) on the topic and follow the prompts
to submit the change.

Be sure to search the whole topic for multiple lines that might be
wrong. We hold multiple versions of a topic in the same file. This sentence
might appear two or more times. All instances that you find should be
updated.

When you open the issue, put ...

Fixes #18997

... in the opening comment so that this issue will automatically close
when the PR merges.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/AspNetCore.Docs/issues/18997#issuecomment-651257255,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AB3P3H4LT3NUAVWCFWNENR3RZDFIDANCNFSM4OLK2DZQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

serpent5 picture serpent5  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

AnthonyMastrean picture AnthonyMastrean  Â·  3Comments

madelson picture madelson  Â·  3Comments

YeyoCoder picture YeyoCoder  Â·  3Comments