Using serilog on Sitecore 9.0.1

Sitecore Asked by alecasciaro on December 13, 2021

I’m using Sitecore 9.0.1. I would like to replace log4net with Serilog.

How do I configure it for 9.0.1?

One Answer

We are using Serilog in our Sitecore 9.0.3 project. It works great. One way of achieving this is shown here:

It's basically using Serilog and Serilog.Sinks.File NuGet packages.

If you don't like to do the startup.cs way, you can inject a Serilog initialization class after "Sitecore.Mvc.Pipelines.Loader.InitializeDependencyResolver" using the patch config and initialize the Log.Logger = new LoggerConfiguration() as shown in the above url using all the required settings from another config file.

And while using Serilog. Use it like this: using Log = Serilog.Log;

Log.Information(), Log.Warning(), Log.Error(), and so on.

Answered by Pawan on December 13, 2021

Add your own answers!

Related Questions

Using WFFM 9.0 rev. 180503 with Sitecore 9.1

1  Asked on August 23, 2021 by david-masters


Can not install Sitecore.CLI for Sitecore 10

1  Asked on February 21, 2021 by nikola-kramaric


How to become a Sitecore MVP?

3  Asked on February 10, 2021 by tamas-varga-sitecore


Azure Deploy of CM + Reporting

2  Asked on February 6, 2021 by dave-g


Get Sitecore From submission attempts

1  Asked on January 12, 2021 by mohamed-yaseen


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP