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.
new LoggerConfiguration()
.WriteTo.Trace()
...
.CreateLogger();
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?
, , , :

()