Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Console logging example from README does not show output under IIS/in-process hosting #107

Closed
CreepyGnome opened this issue Aug 14, 2019 · 3 comments
Labels

Comments

@CreepyGnome
Copy link

I followed the instructions in the readme.md file and I have attached the basic default ASP.NET Core Web API generated project with only the changes the readme states and there is no output in the "ASP.NET Core Web Server" output.

See attached very clean default project. It runs and should have "Started web host" in the output window but doesn't show up in any of the output options, including the "ASP.NET Core Web Server" output.

I would expect to do what the steps stated the Instructions section would work as it states, yet it does not. Not sure what is wrong as I've never used Serilog and wanted to see it in action and nothing I tried could get it to work so went to a clean project and exact instructions to ensure it wasn't me and it doesn't seem to me as the steps don't work in a clean project.

https://github.com/serilog/serilog-aspnetcore#instructions

Please fix whatever is missing in the Readme.md so that it will work with an ASP.NET Core Web API default template project. I used Visual Studio 2019 Ent to generate the default project for Core 2.2 SDK.

FunWithSerilogAspNetCore.zip

@nblumhardt
Copy link
Member

Hi @CreepyGnome - the problem here is that the IIS in-process hosting model eats console output. If you run the app as a console app instead, all is there as expected.

I think we'll update the README/examples to show WriteTo.Debug(), which will show up in these cases. Thanks!

@nblumhardt nblumhardt changed the title Readme.md Instructions Don't work Console logging example from README does not show output under IIS/in-process hosting Aug 16, 2019
@CreepyGnome
Copy link
Author

@nblumhardt so WriteTo.Debug() will overwrite the InProcess and output to the ASP.net core console? This will require the Serilog.Sinks.Debug package then I assume.

So to use the config settings I would just do this then:

"Serilog": {
    "MinimumLevel": "Warning",
    "WriteTo": [
      "Debug",
      {
        "Name": "Async",
        "Args": {
          "Configure": [
            {
              "Name": "Console",
              "Args": {
                ...
              }
            },
            {
              "Name": "File",
              "Args": {
                ...
              }
            }
          ]
        }
      },
      {
        "Name": "Sentry",
        "Args": {
          ...
        }
      }
    ]

@nblumhardt
Copy link
Member

👍

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

No branches or pull requests

2 participants