Skip to content

Serilog sink for Azure Queue Storage to replace deprecated / deleted package

License

Notifications You must be signed in to change notification settings

GMIRelayMed/Serilog.Sinks.AzureQueueStoragev2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Sinks.AzureQueueStoragev2

Package - Serilog.Sinks.AzureQueueStoragev2 | .NET Standard 2.0

Package to write to an Azure Queue in an Azure Storage Account. This package replaces the deprecated and no longer maintained library of Serilog.Sinks.AzureQueueStorage.

It now uses the Azure.Storage.Queues which replaces the deprecated WindowsAzure.Storage, which was used in the previous package.

Getting started guide with Azure Queues.

Using Azure Managed Identities

To log using this sink from an Azure App Service or Function:

  • Enable System Assigned Managed Identity from the Identity section in the Azure Portal
  • On the storage account give the App the Role: Storage Queue Data Message Sender
  • Configure the sink with the URL for the storage account queue; this the Sink will use the AzureDefaultCredentials for access to the queue.

Build status

Build Status

Example use

var log = new LoggerConfiguration().WriteTo
    .AzureQueueStorage("azureStorageAccountConnectionString", "azureQueueName")
    .CreateLogger();

Or to use DefaultAzureCredentials:

var log = new LoggerConfiguration().WriteTo
    .AzureQueueStorage(new Uri("<storage_account_url>/<quene_name>"))
    .CreateLogger();

Optional parameter of restrictedToMinimumLevel which is an LogEventLevel enum that defines the minimum level of logging. By default this is set to 0 (verbose). You can override like so:

var log = new LoggerConfiguration().WriteTo
    .AzureQueueStorage("azureStorageAccountConnectionString", "azureQueueName", LogEventLevel.Information)
    .CreateLogger();
var log = new LoggerConfiguration().WriteTo
    .AzureQueueStorage(new Uri("<storage_account_url>/<quene_name>"), LogEventLevel.Information)
    .CreateLogger();

About

Serilog sink for Azure Queue Storage to replace deprecated / deleted package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages