Owin makes a lot of track registration noise

I have a small console application that works with TopShelf and uses Serilog as a logging tool, where I would like to run OWIN internally. However, as soon as I started the application builder, each log message is duplicated through the trace listener and, therefore, is printed twice on the console.

// serilog sink configuration
new LoggerConfiguration()
        .WriteTo.Trace()
        ...
        .CreateLogger();

// topshelf
HostLogger.UseLogger(new SerilogLogWriterFactory.SerilogHostLoggerConfigurator());

I already found this answer here and included the following before I started the web host:

        webHostOptions.Settings.Add(typeof (ITraceOutputFactory).FullName,
            typeof (WebAppBuilder.NullTraceOutputFactory).AssemblyQualifiedName);
        Trace.Listeners.Remove("HostingTraceListener");

The funny thing is: when I first started the application after inserting these lines, it worked (for example, double messages disappeared.). However, after cleaning my catalog, \binthey began to appear again. What to do?

, , , :

...

()

+4

Source: https://habr.com/ru/post/1598233/


All Articles