serilog/serilog-extensions-hosting

[Question] What package should be used for .NET Core background service?

KUTlime opened this issue ยท 4 comments

I have a question regarding this line:

ASP.NET Core applications should consider using Serilog.AspNetCore instead, which bundles this package and includes other ASP.NET Core-specific features.

from Readme.md

How about .NET Core 3.x Console application? What package should be used?
How about .NET Core 3.x Background Worker project? What package should be used?

If you are building a "headless" (i.e. no HTTP response) app, like a console application or background worker service, then this is the package you want.

As those services don't use middleware, there's no value in the middleware that Serilog.AspNetCore adds.

Hope that make sense ๐Ÿ™‚

Thank you. I suggest to extend Readme.md with this information.

Here @nblumhardt wrote:

In ASP.NET 3.0 apps we're going to be recommending UseSerilog() on IHostBuilder rather than at the web host level.

Is that still the plan? It seems to be possible already, since the UseSerilog() implementations are more or less identical and GenericWebHostBuilder.ConfigureServices() just forwards to the underlying IHostBuilder.ConfigureServices().

@stijnherreman yes, that's the case now ๐Ÿ‘ (The linked comment is > 6 months old :-) )