Microsoft.Extensions.Logging.AzureAppServices
Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features. This package was built from the source code at https://github.com/dotnet/dotnet/tree/820230c386db5b0106c5430b3e5aee92a7826bf5
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
About
Microsoft.Extensions.Logging.AzureAppServices provides a logger implementation that logs to text files in an Azure App Service app's file system and to blob storage in an Azure Storage account.
Key Features
- Loging messages with the "Diagnostics Logger" and "Log Streaming" features of Azure App Service
- Integration with Azure App Service logging infrastructure
- Seamless integration with other components of
Microsoft.Extensions.Logging
How to Use
To use Microsoft.Extensions.Logging.AzureAppServices, follow these steps:
Installation
dotnet add package Microsoft.Extensions.Logging.AzureAppServices
Configuration
To configure provider settings, use AzureFileLoggerOptions and AzureBlobLoggerOptions, as shown in the following example:
using Microsoft.Extensions.Logging.AzureAppServices;
var builder = WebApplication.CreateBuilder();
builder.Logging.AddAzureWebAppDiagnostics();
builder.Services.Configure<AzureFileLoggerOptions>(options =>
{
options.FileName = "azure-diagnostics-";
options.FileSizeLimit = 50 * 1024;
options.RetainedFileCountLimit = 5;
});
builder.Services.Configure<AzureBlobLoggerOptions>(options =>
{
options.BlobName = "log.txt";
});
Main Types
FileLoggerProvider: ABatchingLoggerProviderwhich writes out to a fileBlobLoggerProvider: TheILoggerProviderimplementation that stores messages by appending them to Azure Blob in batchesAzureFileLoggerOptions: Options for configuring Azure diagnostics file loggingAzureBlobLoggerOptions: Options for configuring Azure diagnostics blob logging
Additional Documentation
For additional documentation and examples, refer to the official documentation on logging with ASP.NEt Core and Azure App Service.
Feedback & Contributing
Microsoft.Extensions.Logging.AzureAppServices is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.