问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/57526622/how-to-setup-configuration-in-net-framework-for-serilog