Serilog: SelfLog isn't outputting anything

Created on 20 Sep 2016  路  1Comment  路  Source: serilog/serilog

I'm actually trying to troubleshoot a problem where the SqlServer sink isn't writing anything to my database tables. I was advised to hook up the SelfLog to see what was going on but it isn't actually outputting anything and I'm not sure if I'm missing something. This is the setup method:

public SerilogLogger()
{
    Serilog.Debugging.SelfLog.Enable(msg => System.Diagnostics.Trace.WriteLine(msg));
    _logger = new LoggerConfiguration()
        .WriteTo.MSSqlServer(@"Server=<MyConnectionString>", "Logs")
        .WriteTo.Trace()
        .CreateLogger();
}

The logs are being written to the output window via trace but nothing goes to the database and Serilog isn't outputting anything. I even tries deliberately messing up the connection string just to get it to output anything and no dice. Any thoughts?

Most helpful comment

Following up here in case anyone encounters the ticket; the issue was a missing call to:

Log.CloseAndFlush();

at completion of the test in which the code above was being executed.

>All comments

Following up here in case anyone encounters the ticket; the issue was a missing call to:

Log.CloseAndFlush();

at completion of the test in which the code above was being executed.

Was this page helpful?
0 / 5 - 0 ratings