Despite hours spent on google, I am not getting there. We have a Core 3.1 MVC Web App project, and I've been asked to use SeriLog to write logs to Azure Table Storage. For the life of me, I can't find a working example or tutorial online. Here's what I've done so far:
- Added the following NuGet's:
- Serilog
- Serilog.Extensions.Logging
- Serilog.Sinks.AzureTableStorage
- In appsettings.json,I replaced this:
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Warning"
}
With this:
"Serilog": {
"WriteTo": [
{
"Name": "AzureTableStorage",
"Args": {
"storageTableName": "Logs",
"connectionString": "DefaultEndpointsProtocol=https;AccountName=***;AccountKey=***;EndpointSuffix=core.windows.net"
}
}
]
},
And now I am stuck. This is currently in Program.cs in CreateHostBuilder :
.ConfigureLogging(logging =>
{
logging.AddConsole();
})
I assume I should replace this? But, with what? I am not sure where to go from here. The serilog-sinks-azuretablestorage page on Github isn't much help. And I've been unable to find anything via Google that explains how to finish the implementation.