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

I can't make LogLevel work #41

Open
rodrigomocca opened this issue May 6, 2020 · 1 comment
Open

I can't make LogLevel work #41

rodrigomocca opened this issue May 6, 2020 · 1 comment

Comments

@rodrigomocca
Copy link

Hi,
I'm trying the extension, and it's working great, but I can't get Debug Levels logged.
I've settled up the app.settings like this:

"Logging": {
    "PathFormat": "Logs/log-{Date}.txt",
    "LogLevel": {
      "Default": "Debug",
      "Microsoft": "Information"
    }
  },

And the Startup.cs like this:
loggerFactory.AddFile(Configuration.GetSection("Logging"));

I'm trying really simple from a controller:
_logger.LogDebug("TestController");

But the log is not in the file. If I change
_logger.LogDebug("TestController") to _logger.LogInformation("TestController"); the log shows in the log file as expected.

What I'm doing wrong?

Thanks for your help.

@lkarabeg
Copy link

lkarabeg commented Jul 21, 2020

I'm a bit late to the party, but hopefully this will help someone else.

What I just discovered is that the config that comes with ASP.Net Core apps does limit the output. This is sort of undercommunicated, and contrary to some of the information out there. In any case, if you have the below config somewhere (appsettings.Development.json?) it makes it impossible to increase the verbosity using the parameter passed to AddFile.

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }
}

Edit: To clarify, you don't have to pass these parameters to AddFile for them to limit the output

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

No branches or pull requests

2 participants