dotnetcore serilog using rolling file
serilog is a logging component for .net. To serilog into your project and configure logging from your project configuration file, here's what you need to do.
First, you need to install the following packages :-
Install-Package Serilog.Extensions.Logging -DependencyVersion Highest
Install-Package Serilog.Sinks.RollingFile
Install-Package Serilog.Settings.Configuration
In your start up, you need to configure serilog using the following code.
Next, just add it in your log factory,
Next, see how our configuration file looks like. Here are we telling serilog to log to a folder in c:\temp.
Well, that's all you need to do to add serilog into your project.
Comments