Closed ManaiAbdessalem closed 1 year ago
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: https://github.com/JDetmar/NLog.Extensions.AzureStorage/blob/master/src/NLog.Extensions.AzureBlobStorage/README.md
See also: https://stackoverflow.com/questions/76721836/nlog-in-azure-file-share See also: https://stackoverflow.com/questions/73767453/how-to-integrate-nlog-to-write-log-to-azure-file-share-in-net See also: https://learn.microsoft.com/en-us/rest/api/storageservices/operations-on-files (No append operation)
If you are mounting as network-file-share (SMB / NFS), then I guess you can just use NLog FileTarget (KeepFileOpen
=false) and assign FileName
to the mounted network-drive.
See also: https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows See also: https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-linux
Thanks for your help. I used File target and i mounted an Azure File Share to AppService directory that contains logs. It works well!
I am using Nlog in my C# project and i want to save logs in Azure File Share. I found this nuget and its Github "NLog.Extensions.AzureStorage". https://github.com/JDetmar/NLog.Extensions.AzureStorage It contains Targets: AzureAccessToken, AzureBlobStorage, AzureCosmosTable, AzureDataTables, AzureEventGrid, AzureEventHub, AzureQueueStorage, AzureServiceBus.
But there is no target for Azure File Share.
Does anyone know why Azure File Share isn't on the list? Has anyone used nlog in azure file share?