GitHunt
SU

superhappychris/NLog.Extensions.AzureStorage

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

NLog.Extensions.AzureStorage AppVeyor NuGet

logo

NLog Target for Azure Blob and Table Storage.

Blob Configuration

Syntax

<targets>
  <target xsi:type="AzureBlobStorage"
          name="String"
          layout="Layout"
          blobName="Layout"
          connectionString="String"
          connectionStringKey="String"
          container="Layout" />
</targets>

Parameters

name - Name of the target.

layout - Text to be rendered. Layout Required.

blobName - BlobName. Layout

connectionString - Azure storage connection string. Must provide either connectionString or connectionStringKey.

connectionStringKey - App key name of Azure storage connection string. Must provide either connectionString or connectionStringKey.

container - Azure blob container name. Layout

Table Configuration

Syntax

<targets>
  <target xsi:type="AzureTableStorage"
          name="String"
          layout="Layout"
          connectionString="String"
          connectionStringKey="String"
          tableName="Layout" />
</targets>

Parameters

name - Name of the target.

layout - Text to be rendered. Layout Required.

connectionString - Azure storage connection string. Must provide either connectionString or connectionStringKey.

connectionStringKey - App key name of Azure storage connection string. Must provide either connectionString or connectionStringKey.

tableName - Azure table name. Layout

Sample Configuration

<targets async="true">
    <target type="AzureBlobStorage"
            name="AzureEmulator"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring:innerFormat=tostring:maxInnerExceptionLevel=1000}"
            connectionString="UseDevelopmentStorage=true;"
            container="${level}"
            blobName="${date:universalTime=true:format=yyyy-MM-dd}/${date:universalTime=true:format=HH}.log" />
    <target type="AzureBlobStorage"
            name="Azure"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring:innerFormat=tostring:maxInnerExceptionLevel=1000}"
            connectionStringKey="storageConnectionString"
            container="${machinename}"
            blobName="${logger}/${date:universalTime=true:format=yy-MM-dd}/${date:universalTime=true:format=mm}.log" />
    <target type="AzureTableStorage"
            name="AzureTable"
            connectionStringKey="storageConnectionString"
            layout="${longdate:universalTime=true} ${level:uppercase=true} - ${logger}: ${message} ${exception:format=tostring:innerFormat=tostring:maxInnerExceptionLevel=1000}"
            tableName="NlogTable" />
</targets>

Languages

C#100.0%

Contributors

MIT License
Created September 6, 2018
Updated September 6, 2018
superhappychris/NLog.Extensions.AzureStorage | GitHunt