I'm actually trying to troubleshoot a problem where the MSSqlServer 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 methods in this class are just calling log methods on the _logger
which is set up here. The logs that I'm creating are being written to the output window via the trace sink, but nothing goes to the database and Serilog isn't outputting anything let alone any errors. I even tried deliberately messing up the connection string just to get it to output anything and no dice. Any thoughts?