You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the application on linux, everything seems to work. Opening a archived log file shows a problem: the files are archived with permission 0000 - no one can read them. The Linux unzippers do respect these permission masks (unlike windows tools) which results in a file that no one can read and a sudo operation is required to fix the file permissions before opening the file.
I recently stumbled upon the same problem and I think I know how to fix it. Unfortunately I don't have a windows machine at hand to compile the complete code, therefore the proposed fix via comment:
.net core now exposes the ExternalAttributes property of ZipArchiveEntry that allows you to set permissions, like this (664):
note that the string is an octal representation of the permission bit mask, therefore the convert to base 8. The line should probably embedded in some compiler-if checking for netstandard.
The text was updated successfully, but these errors were encountered:
The preferred goal is to refactor and extract the zip-compression logic out of FileTarget into its own nuget-package. See #2732 (Maybe with help from #1249).
The NLog FileTarget is already a gnarly old class, that have taken on many warts (options). And doing a lot more than just write to a file :)
But thank you for the great input. When a champion arrives that is ready to take on the task, then this option would be great to include.
ExternalAttributes appears to be available in .NET Core 2.x but it is not available in .NET Standard 2
Strange that Microsoft have not included good default values for ExternalAttributes out-of-box on the Linux-platform. Kind of ruin the illusion of NetCore.
NLog version: 4.5.11
Platform: .NET Core 3
Current NLog config (xml or C#, if relevant)
Running the application on linux, everything seems to work. Opening a archived log file shows a problem: the files are archived with permission 0000 - no one can read them. The Linux unzippers do respect these permission masks (unlike windows tools) which results in a file that no one can read and a sudo operation is required to fix the file permissions before opening the file.
I recently stumbled upon the same problem and I think I know how to fix it. Unfortunately I don't have a windows machine at hand to compile the complete code, therefore the proposed fix via comment:
.net core now exposes the
ExternalAttributes
property ofZipArchiveEntry
that allows you to set permissions, like this (664):note that the string is an octal representation of the permission bit mask, therefore the convert to base 8. The line should probably embedded in some compiler-if checking for netstandard.
The text was updated successfully, but these errors were encountered: