Closed macladson closed 2 years ago
Oh, you're right. We need to address this problem.
I suspect this is because unlike the regular file rotation ...
Yes. When compression mode is enabled, sloggers
compresses a log file at the time that the file gets rotated (that is, sloggers
never compress log messages just when they're being written to a log file). So perhaps it's needed to call the restrict_file_permissions()
function at that time too.
I only noticed this after #51 was merged, but when building a file logger, if both
restrict_permissions
andcompress
are set, the logfile is initially created with umask of600
but upon compression, the compressed files are set to644
.I suspect this is because unlike the regular file rotation which simply renames the files in place (leaving any existing permissions intact), compression creates a new file (with a new set of permissions) which the contents of the log file are then written into.