Working with SeriLog in .NET Core Application

Dheeraj Kumar Gunti

Reading Time : ( words)

.NET Core is a set of runtime, library and compiler components that allow you to create apps that run on Windows, Mac OS X and Linux. It can be installed locally with your app with only the packages you need. It provides a lightweight development model and the flexibility to work with your favorite development tools on your favorite development platform. If you're new to .NET Core, visit the Getting Started page to find installation instructions for each supported platform.

More about : .NET Core

Today we will see how to integrate SeriLog in to our Web application. Here we are using the all new .NET Core Capabilities. The solution now we are building is over ASP.NET 5.0 (.NET Core).

Download Seq from Seq - Machine data, for humans

Once the download is done. Install the application as guided by the wizard.

Once the installation is successfull. We will now continue in building a small application.

Create a new ASP.NET Web Application and in the template wizard. If you see ASP.NET 5.0 and if it is not installed. Please install .NET Core. Once the install is done. You can see the templates listed as below. You got to choose either .NET Core or with .NET framework.

As today we are talking about .NET Core we will be dealing with .NET Core template.

Choose Web Application and click on OK.

Specify the SeriLog packages as below in project.json.

Once the packages are included then you can observe that solution is restoring the packages.

Open Startup.cs file and on the Configure method add the below code.

Run the application and even browse Seq at http://localhost:5341

You can able to see all the trace of events which are running on the application in Seq.

Download Sample Application

Happy Coding....