Serilog MSSqlServer table schema

Viewed 1211

Is there any way to change the default schema to something other than dbo? I am developing a CORE 2.0 web api and using MSSqlServer as sink. Tried adding "Schema": "Log" in the appsettings.json file, and it does not work.

Thanks

2 Answers

The MSSqlServer sink can take an optional parameter "schemaName":

 Log.Logger = new LoggerConfiguration()
     .WriteTo.MSSqlServer(connectionString, "MyLogs", schemaName: "myschema")
     .CreateLogger();

See the MSSqlServer sink configuration options documentation for more information.

Related