Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 2.36 KB

File metadata and controls

59 lines (43 loc) · 2.36 KB

Bet.AspNetCore.Logging

GitHub license Build status NuGet Nuget feedz.io

The second letter in the Hebrew alphabet is the ב bet/beit. Its meaning is "house". In the ancient pictographic Hebrew it was a symbol resembling a tent on a landscape.

Note: Pre-release packages are distributed via feedz.io.

Summary

The collection of AspNetCore functionality for logging with Azure AppInsight and Azure Log Analyzer extends Serilog.

buymeacoffee

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Install

    dotnet add package Bet.AspNetCore.Logging

Usage

To enable Azure ApplicationInsights and/or LogAnalytics Seriglog sinks add the following in Program.cs:

    .UseSerilog((hostingContext, loggerConfiguration) =>
    {
        var applicationName = $"myapp.-{hostingContext.HostingEnvironment.EnvironmentName}";
        loggerConfiguration
                .ReadFrom.Configuration(hostingContext.Configuration)
                .Enrich.FromLogContext()
                .WriteTo.Console()
                .AddApplicationInsights(hostingContext.Configuration)
                .AddAzureLogAnalytics(hostingContext.Configuration, applicationName: applicationName);
    })

Make sure that the following Options values are supplied.

  "ApplicationInsights": {
    "InstrumentationKey": "",
    "EnableEvents": true,
    "EnableTraces": true
  },

  "AzureLogAnalytics": {
    "WorkspaceId": "",
    "AuthenticationId": ""
  }