Skip to content

NLog Target for Azure Storage. Uses NLog batch write to optimize writes to Storage.

License

Notifications You must be signed in to change notification settings

JDetmar/NLog.Extensions.AzureStorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NLog Targets for Azure Storage AppVeyor

logo

Package Name NuGet Description Documentation
NLog.Extensions.AzureBlobStorage NuGet Azure Blob Storage
NLog.Extensions.AzureDataTables NuGet Azure Table Storage or Azure CosmosDb Tables
NLog.Extensions.AzureEventHub NuGet Azure EventHubs
NLog.Extensions.AzureEventGrid NuGet Azure Event Grid
NLog.Extensions.AzureQueueStorage NuGet Azure Queue Storage
NLog.Extensions.AzureServiceBus NuGet Azure Service Bus
NLog.Extensions.AzureAccessToken NuGet Azure App Authentication Access Token for Managed Identity

Initially all NLog targets was bundled into a single nuget-package called NLog.Extensions.AzureStorage. But Microsoft decided to discontinue WindowsAzure.Storage and split into multiple parts. Later Microsoft also decided to discontinue Microsoft.Azure.DocumentDB and so NLog.Extensions.AzureCosmosTable also became deprecated.

Sample Configuration

<extensions>
  <add assembly="NLog.Extensions.AzureBlobStorage" /> 
  <add assembly="NLog.Extensions.AzureDataTables" /> 
  <add assembly="NLog.Extensions.AzureQueueStorage" /> 
  <add assembly="NLog.Extensions.AzureEventHub" /> 
  <add assembly="NLog.Extensions.AzureEventGrid" /> 
  <add assembly="NLog.Extensions.AzureServiceBus" /> 
  <add assembly="NLog.Extensions.AzureAccessToken" /> 
</extensions>

<targets async="true">
    <target type="AzureBlobStorage"
            name="Azure"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring}"
            connectionString="DefaultEndpointsProtocol=https;AccountName=##accountName##;AccountKey=##accountKey##;EndpointSuffix=core.windows.net"
            container="${machinename}"
            blobName="${logger}/${date:universalTime=true:format=yy-MM-dd}/${date:universalTime=true:format=HH}.log">
                <metadata name="mymeta" layout="mymetavalue" />   <!-- Multiple allowed -->
    </target>
    <target type="AzureDataTables"
            name="AzureTable"
            connectionString="DefaultEndpointsProtocol=http;AccountName=##accountName##;AccountKey=##accountKey##;"
            layout="${message} ${exception:format=tostring}"
            tableName="NlogTable" />
    <target type="AzureQueueStorage"
            name="AzureQueue"
            connectionString="UseDevelopmentStorage=true;"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring}"
            queueName="NlogQueue">
                <metadata name="mymeta" layout="mymetavalue" />   <!-- Multiple allowed -->
    </target>
    <target type="AzureEventHub"
            name="AzureEventHub"
            connectionString="Endpoint=sb://test.servicebus.windows.net/;SharedAccessKeyName=NLog;SharedAccessKey=EventHub"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring}"
            eventHubName="NlogHub"
            PartitionKey="0">
                <messageProperty name="exceptiontype" layout="${exception:format=type}" />   <!-- Multiple allowed -->
    </target>
    <target type="AzureServiceBus"
            name="AzureServiceBus"
            connectionString="Endpoint=sb://test.servicebus.windows.net/;SharedAccessKeyName=NLog;SharedAccessKey=ServiceBus"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring}"
            label="Message from NLog"
            topiceName="NLogTopic">
                <messageProperty name="exceptiontype" layout="${exception:format=type}" />   <!-- Multiple allowed -->
    </target>
</targets>

License

FOSSA Status

About

NLog Target for Azure Storage. Uses NLog batch write to optimize writes to Storage.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages