Question searched on google .
How to check whether Serilog internal exception occurs .
Serilog not writing logs to database
The given ColumnMapping does not match up with any column in the source or destination serilog
In order to get to know what is making the Serilog not perform its job of logging in to Database server we will enable the Serilogs self logging .
In order to do that we will have to add these lines to Program.cs in Main method.
string pathFile = @"Logs/SeriSelf.log";
var file = System.IO.File.CreateText(pathFile);
public static void Main(string[] args)
{
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
string pathFile = @"Logs/SeriSelf.log";
var file = System.IO.File.CreateText(pathFile);
Serilog.Debugging.SelfLog.Enable(TextWriter.Synchronized(file));
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Console()
.CreateLogger();
try
{
Log.Information("Getting the Application Clanstech Running... ");
CreateHostBuilder(args).Build().Run();
}
catch(Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly");
}
finally
{
Log.CloseAndFlush();
}
}
Now run the application . You will see a log file named SeriSelf.log in Logs Folder . Open it and check if it has any content then there is some problem else Serilog is running fine .
Now for the Question
The given ColumnMapping does not match up with any column in the source or destination serilog
This happens when the table column does not match with specification of Serilog internal working . In my case i had created the table Log with column LogId as Primary key which was making this error , hence after changing that to Id everything worked fine .
f4dd1763-bc62-436c-8080-a0c792fb5a73|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
ASP.NET MVC Core, Debugging, Exceptions, Logging, Serilog
Serilog, Serilog Self Logging