I'm having some trouble with logging in Azure. I'm using the AzureAppServices FileLoggingProvider.
It doesn't seem to be a simple configuration issue as I can actually confirm that for the first log message that get's written (the first time a new log file is created) the logging is working correctly and I can see it within the log stream in the azure portal. After that no log messages are written. I thought it might be a buffering issue but I waited for 20 minutes and still didn't see any new log messages coming in. If I delete the log file then new log messages are immediately written to a new file and I can see them in the log stream. I'm using mostly default options for my logging configuration
builder.Services.Configure<AzureFileLoggerOptions>(options =>
{
options.FileName = "azure-diagnostics-";
options.FileSizeLimit = 50 * 1024;
options.RetainedFileCountLimit = 5;
});
I'm having some trouble with logging in Azure. I'm using the AzureAppServices FileLoggingProvider.
It doesn't seem to be a simple configuration issue as I can actually confirm that for the first log message that get's written (the first time a new log file is created) the logging is working correctly and I can see it within the log stream in the azure portal. After that no log messages are written. I thought it might be a buffering issue but I waited for 20 minutes and still didn't see any new log messages coming in. If I delete the log file then new log messages are immediately written to a new file and I can see them in the log stream. I'm using mostly default options for my logging configuration
builder.Services.Configure<AzureFileLoggerOptions>(options =>
{
options.FileName = "azure-diagnostics-";
options.FileSizeLimit = 50 * 1024;
options.RetainedFileCountLimit = 5;
});
Share
Improve this question
edited 2 days ago
Suresh Chikkam
3,3802 gold badges4 silver badges12 bronze badges
Recognized by Microsoft Azure Collective
asked Feb 17 at 15:52
Luke BrooksLuke Brooks
1
New contributor
Luke Brooks is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
|
1 Answer
Reset to default 0Many of the users have reported that the log file becomes locked, preventing further writes. Deleting the existing log file forces the system to create a new one, this will temporarily resolve the issue.
And also, observed that logs are buffered and not immediately flushed to the file system, leading to delays in log visibility. Adjusting the logging configuration to reduce buffering intervals can clear this problem.
- Try using Application Insights, it is a telemetry and logging platform offers real-time monitoring of log events. Add the
Microsoft.Extensions.Logging.ApplicationInsights
package and configure Application Insights in the app.
builder.Services.AddApplicationInsightsTelemetry();
builder.Logging.AddApplicationInsights();
Monitor logs in the Azure Portal under the Application Insights resource.
FileSizeLimit.
– Suresh Chikkam Commented Feb 18 at 7:14