Correct way to use Serilog with WebApi2
问题 I am in search of the correct way to use serilog with aspnet webapi2. As for now I initialize the global Log.Logger property like that : public static void Register(HttpConfiguration config) { Log.Logger = new LoggerConfiguration() .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri("http://localhost:9200")) { IndexFormat = IndexFormat, BufferBaseFilename = outputLogPath, AutoRegisterTemplate = true, AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6, CustomFormatter = new