Q:

Serilog topshelf integration not working

I'm trying to set up a simple logging configuration for my Windows service using Topshelf and Serilog (the Serilog.Extras.Topshelf package respectively). 
HostLogger.UseLogger(new SerilogHostLoggerConfigurator(new LoggerConfiguration()
                .WriteTo.RollingFile(AppDomain.CurrentDomain.BaseDirectory + "\\logs\\app-{Date}.log")
                .WriteTo.ColoredConsole()
                .MinimumLevel.Debug()
                .CreateLogger()));
HostFactory.Run(x => {
            x.UseSerilog();
            ...

The service runs fine, however no output is made, neither to the console nor the specified log file (I can see that one is being created but it remains empty). Has anyone experience using both frameworks?

A:

The second call "x.UseSerilog()" resets TopShelf's HostLogger to use Serilog's global instance (Log.Logger), which you have not configured.
Remove the second call and the logging should start working.
Another option is to configure the global logger:
Log.Logger = new LoggerConfiguration()
            .WriteTo.RollingFile(AppDomain.CurrentDomain.BaseDirectory + "\\logs\\app-{Date}.log")
            .WriteTo.ColoredConsole()
            .MinimumLevel.Debug()
            .CreateLogger();

HostFactory.Run(x => {
        // configure TopShelf to use Serilog's global instance.
        x.UseSerilog();
}

