-
Notifications
You must be signed in to change notification settings - Fork 146
.ReadFrom.Configuration(Configuration) does not load serilog.sinks.mssqlserver (dotnetcore 2.0) #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, the name of the keys of the In this case, the underlying method is : public static LoggerConfiguration MSSqlServer(
this LoggerSinkConfiguration loggerConfiguration,
string connectionString,
string tableName,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
int batchPostingLimit = MSSqlServerSink.DefaultBatchPostingLimit,
TimeSpan? period = null,
IFormatProvider formatProvider = null,
bool autoCreateSqlTable = false,
ColumnOptions columnOptions = null,
string schemaName = "dbo"
) so your config file should look like : ... stuff before ...
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Data Source=...",
"tableName": "FullLog"
}
}
... stuff after ... |
Thank you, that was the problem .. |
thank you . BTW : it seems I can redefine the name of basic "built in columns" : but I find no way to change the data type thank you |
Correct. PR123 will let you specify column options as long as you're using .NET Standard's Microsoft.Extensions.Configuration. |
Uh oh!
There was an error while loading. Please reload this page.
serilog.sinks.mssqlserver\5.1.0
\serilog.settings.configuration\2.5.0
\serilog.aspnetcore\2.1.0
\serilog\2.6.0
public void Configure( ...
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(Configuration)
.CreateLogger();
appsettings
"Serilog": {
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "RollingFile",
"Args": { "pathFormat": "D:\IS2009\Service\MediaPortal.Events.Api\logs\mediaportal\events-{Date}.txt" }
},
{
"Name": "MSSqlServer",
"Args": {
"ConnectionString": "Data Source=...",
"TableName": "FullLog"
}
}
]
},
"RollingFile" is loaded but "MSSqlServer" is not , what am I doing wrong ?
if I do
var logger = new LoggerConfiguration()
.WriteTo.MSSqlServer(connectionString, tableName, columnOptions: columnOptions)
.CreateLogger();
It does work ?!
thank you
enrico
The text was updated successfully, but these errors were encountered: