Azure Table Storage Target for NLog
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Note: This project is not actively maintained

NLog Azure Table Storage Target

Azure Table Storage Target for NLog

For more info about NLog targets and how to use it, refer to How To Write a Target


Download package from Nuget

How to use

  • Download package from Nuget.
  • If you didn't setup Azure storage connection string yet, follow instructions in Setup a storage connection string.
  • Open NLog configurations file ex: NLog.config and add the following lines:
  • Add NLog.Extensions.AzureTableStorage assemply to extensions section:
    <add assembly="NLog.Extensions.AzureTableStorage"/>
  • Add AzureTableStorage target to targets section:
    <target xsi:type="AzureTableStorage" 

Where [[target-name]] is a name you give for the target, [[connection-string-key]] is the key of Azure Storage Account connection string setting in App Settings or Cloud Service configuration file, and [[table-name]] is a name you give to the log table that will be created.

If multiple applications need to share the same storage account it is possible to prefix the partition keys used with a custom string. [[PartitionKeyPrefix]] and [[PartitionKeyPrefixKey]] are optional and [[PartitionKeyPrefixKey]] has precedence over a hard coded value in [[PartitionKeyPrefix]]. Further, you can use [[PartitionKeyPrefixDateFormat]] to provide a standard DateTime format string to prefix the partition with, which may result in a better partitioning strategy in some use cases.

Optionally specify a value for [[LogTimestampFormatString]] to override the default format string of "g" for the LogTimeStamp field.

  • Add a rule that uses the target in rules section.
    <logger name="*" minlevel="Trace" writeTo="[[target-name]]" />

Note: You can also configure this by code refer to How To Write a Target for more information.

How to View Logs?

A lot of ways you can access table storage.


  • Before running tests on you local machine, make sure Azure Storage Emulator is running.