0

I can't seem to find any example of how to configure NLOG to write logs to Azure File Share file. Does anyone know how to do it? My app is a .NET 4.8 app. I am assuming i should include something like this in my App.config:

  <targets>
    <target name="fileTarget"
            xsi:type="File"
            fileName="\\myazurestorageaccount.file.core.windows.net\fs1\example.log"
          />
 </targets>

That was just my guess because I can't find any examples and it doesn't work. Any help mch appreciated, thanks :)

Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70
Mary
  • 131
  • 2
  • 10
  • 2
    Think there is a limitation with Azure File Shares, that file-append-operation is not available. This means one can only create new files, or append to the file by downloading the existing file and append in memory and upload the entire file again. Usually people use Azure Blob Storage instead of Azure File Share. See also: https://github.com/JDetmar/NLog.Extensions.AzureStorage/blob/master/src/NLog.Extensions.AzureBlobStorage/README.md – Rolf Kristensen Sep 19 '22 at 06:07
  • See also: https://stackoverflow.com/q/76721836/193178 – Rolf Kristensen Aug 29 '23 at 06:21

1 Answers1

1

Like it was mentioned in the comment, you can't really do it. File-append is not available with Azure File Share... So the best option would be to switch to Azure Blob Storage.

Mary
  • 131
  • 2
  • 10