How to setup configuration in .NET Framework for Serilog

12,030

After more investigating (and I can't believe I missed this earlier), the documentation here states you can edit the web.config file. In case anyone is looking for the configuration for web.config, there you go.

Share:
12,030
Ross Gustafson
Author by

Ross Gustafson

A jack of all trades software developer who likes game development in Unity but develops whatever gives me a pay check which is right now Javascript and .NET/C#.

Updated on July 24, 2022

Comments

  • Ross Gustafson
    Ross Gustafson over 1 year

    Our team just moved one of our ASP.NET solutions from logging in log4net to Serilog (using iLogger) for logging. Our solution is .NET Framework 4.6. I can see Serilog configuration documentation online for setting up configuration in code as well as some documentation in appsettings.json. We have Web.config configuration files. Our old log4net configuration resided completely in the csproj files.

    Is there a place for configuration for Serilog and its sinks in .NET Framework (specifically in Web.config or its own XML configuration file)? Do we have to put the configuration into the code (when we create the logger object)? Can we specify the configuration for specific controllers and models we have, and, if so, where is there documentation? I know we could specify locations, log levels, etc. for log4net for specific groups or controllers and models in log4net, but unsure how to do that for Serilog. If you got links for any of this, please point me in the right direction. Thanks.