serilog-sinks-azureblobstorage
serilog-sinks-azureblobstorage copied to clipboard
File is empty when using with WebJob
Are there any considerations when using the package with appservice WebJob? I'm using .net core 2.2. In Program.cs:
var host = new HostBuilder()
.UseConsoleLifetime()
....
.UseSerilog((hostingContext, loggerConfiguration) =>
{
loggerConfiguration.ReadFrom.Configuration(hostingContext.Configuration);
})
.Build();
The appsettings.json:
"Serilog": {
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "AzureBlobStorage",
"Args": {
"connectionString": "comes-from-ci",
"storageContainerName": "myapp",
"storageFileName": "{yyyy}/{MM}/{dd}/log.txt"
}
},
{
"Name": "ColoredConsole"
}
]
},
As a result, the yyyy/MM/dd/log.txt file is created in the Blob storage, however the file is always 0B size.
Another question is, should I turn on any options in the App Service Logs in the AppService configuration when using this library?
Thanks
I was surprised that the file was created at all, because I thought that the library would have trouble getting a valid connection string.
That being said, I originally wrote this library to support logging in a WebJob, so I know that it works. I did most of my configuration in Program.cs, and didn't use appsettings.json for anything other than holding the connection string.
Closing