Skip to content

A Serilog sink that supports Azure App Services 'Diagnostics logs' and 'Log stream' features.

License

Notifications You must be signed in to change notification settings

cnelsonakgov/serilog-sinks-azureapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Sinks.AzureApp NuGet Version

A Serilog sink that supports Azure App Services 'Diagnostics logs' and 'Log stream' features.

Write Serilog events to Azure Diagnostics Application Logging using Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.AzureAppServices. Enables using the the Azure Log Stream and Blob storage for events.

Designed to be used with Serilog.AspNetCore. Works with UseSerilog().

Install

To add Serilog:

dotnet add package Serilog.AspNetCore
dotnet add package Serilog.Sinks.AzureApp

Basic Setup

In Program.cs:

Add reference and update the Main method:

using Serilog;

[...]

Log.Logger = new LoggerConfiguration()
    .Enrich.FromLogContext()
    .WriteTo.Console()
    .CreateLogger();

[...]

Host.CreateDefaultBuilder(args)
    .UseSerilog()
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.UseStartup<Startup>();
    });

Diagnostic logs and log stream are configured in the Azure App Service's Monitoring section.

About

A Serilog sink that supports Azure App Services 'Diagnostics logs' and 'Log stream' features.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages