Closed Veeraraghavans closed 1 year ago
Try builder.Services.UseSerilog();
It didnt work I get error as below:
'IServiceCollection' does not contain a definition for 'UseSerilog' and the best extension method overload 'SerilogWebHostBuilderExtensions.UseSerilog(IWebHostBuilder, ILogger?, bool, LoggerProviderCollection?)' requires a receiver of type 'IWebHostBuilder'
Fixed this issue by importing serilog.extensions.hosting
Hi Team,
I am trying to use Serilog for capturing logs for my Opentelemetry. When I am using Web App console example into my code I am getting following error
error CS1929: 'ConfigureHostBuilder' does not contain a definition for 'UseSerilog' and the best extension method overload 'SerilogWebHostBuilderExtensions.UseSerilog(IWebHostBuilder, ILogger?, bool, LoggerProviderCollection?)' requires a receiver of type 'IWebHostBuilder'
Background of the work,
I am using dotnet7 framework and using Bazel to build the packages. The Aspcore and .NET core are at version 7. The Serilog version is 3.0.1 and Serilog.AspNetCore is 7.0.0.
Code which getting error is
I would like to know is their any dependency issue or I am missing something? It would be helpful if you can hint me some directions what all could lead to such a error. Thanks again