Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serilog's AddSerilog is not recognized

I'm trying to call loggerFactory.AddSerilog(); as per this documentation, but the AddSerilog method is not recognized:

"Error CS1061 'ILoggerFactory' does not contain a definition for 'AddSerilog' and no extension method 'AddSerilog' accepting a first...".

I'm using ASP.NET CORE with the full .NET framework. What am I doing wrong?

like image 339
ashilon Avatar asked Jul 31 '16 13:07

ashilon


People also ask

How to Add Serilog to asp net Core?

Install Serilog Installing Serilog is simple. First, we open the NuGet Package Manager and search for the Serilog. AspNetCore package and install the latest stable version. After a few seconds, Serilog is installed.

Does Serilog work with .NET 6?

Serilog is a robust API for logging with many configurations and sinks (outputs) and it is straightforward to get started in any . NET version. With . NET 6 the way we used to configure Serilog as a logging provider in .


1 Answers

You may forget this following line in project.json

"Serilog.Extensions.Logging": "1.0.0",

See also https://carlos.mendible.com/2016/09/19/step-step-serilog-asp-net-core/

like image 98
Teerachai Avatar answered Sep 24 '22 15:09

Teerachai