WriteTo.MSSqlServer to .net Core 2.1 not working
See original GitHub issueI am having problem while trying to set the configurations via C # by .WriteTo.MSSqlServer
does not work!
Just when I do .ReadFrom.Configuration(Configuration)
works.
ASP.NET MVC Core 2.1 Project
var logDB = settings.ConnectionString.AuditoriaConnection;
var logTable = "LogError";
var options = new ColumnOptions();
options.Store.Add(StandardColumn.LogEvent);
options.LogEvent.DataLength = 2048;
options.PrimaryKey = options.TimeStamp;
options.TimeStamp.NonClusteredIndex = true;
Log.Logger = new LoggerConfiguration()
.WriteTo.MSSqlServer(
connectionString: logDB,
tableName: logTable,
columnOptions: options,
appConfiguration: Configuration)
.CreateLogger();
also tried without the appConfiguration: Configuration),
direct:
.WriteTo.MSSqlServer (logDB, logTable)
My appsetting.json
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Data Source=xxx.yyy.zzz",
"tableName": "LogError",
"autoCreateSqlTable": true,
"restrictedToMinimumLevel": "Information ", //https://github.com/serilog/serilog/wiki/Writing-Log-Events
"columnOptionsSection": {
"customColumns": [
{
"ColumnName": "SetorErro",
"DataType": "int",
"AllowNull": true
},
{
"ColumnName": "LocalErro",
"DataType": "nvarchar",
"DataLength": 150,
"AllowNull": true
}
]
}
}
}
]
}
symptom: it does not create the table and consequently does not write any log
only works via app setting.json if trying via code does not work if it makes hybrid worse yet.
I have read all the documentation, including doing exactly as recommended and nothing https://github.com/serilog/serilog-sinks-mssqlserver#code-only-any-net-target
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
WriteTo.MSSqlServer to .net Core 2.1 not working #185
I am having problem while trying to set the configurations via C # by .WriteTo.MSSqlServer does not work! Just when I do .ReadFrom....
Read more >Serilog.Sinks.MsSqlServer not working with ASP.NET Core ...
Discovered the issue was with the version of Serilog.Sinks.MsSqlServer. Using the latest dev version uses the json configuration correctly.
Read more >Serilog.Sinks.MsSqlServer stops writing to database
Hi I'm using: Asp.Net Core 2.2.0 Serilog.sinks.datadog.logs 0.3.4 ... Information()/Error() statements are not written to database & Datadog.
Read more >Asp.Net Core 2 Logging With Serilog And Microsoft SQL ...
In this post, I'm going to describe how we can configure Serilog with Asp.Net Core 2 web and Api projects. I also configure...
Read more >ASP.Net Core 2.1 Serilog SQL Server Sink using Azure SQL is ...
Coding example for the question ASP.Net Core 2.1 Serilog SQL Server Sink using Azure SQL is working locally but not from Azure app...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have some issue - any help please? Thanks!
Since this report is quite old and we have rewritten a lot of the code in the meantime, I encourage everyone to update to the newest version of the sink. Perhaps the problem is gone, because there were no reports of this for a long time. If the problem reappears with the latest version, pleas open a new but.
I’m closing this issue.