azure-storagenlogazure-storage-filesazure-file-sharestorage-file-share

How to integrate NLog to write log to Azure File Share in .NET


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 :)


Solution

  • 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.