mschout / perl-log-dispatch-filerotate

Log to files that archive/rotate themselves
2 stars 8 forks source link

Leaving lock files around breaks ability for different users to use log file #21

Closed scottm1ll closed 6 years ago

scottm1ll commented 6 years ago

I use log dispatch rotate to write to a client log file with 666 perms so that multiple different users can write to the log (log4perl.appender.Log.permissions = 438). However, since the lock file ignores the umask setting and creates the lock file with ownership of original owner and a mode of 644, any subsequent user fails to write to the log and sees messages written to stderr like the following:

12620 Log::Dispatch::FileRotate failed to get lock: Permission denied 12620 Log::Dispatch::FileRotate not logging

The permissions on the log file and lock file are created as follows:

-rw-rw-rw- 1 mam users 164589 Jun 22 18:27 mam-client.log -rw-r--r-- 1 mam users 0 Jun 22 17:56 .mam-client.log.LCK

I have traced this (new) problem to the change in version 1.28 where .LCK files are being left in place. (Of course, when lock files are transitory, this problem does not happen).

I imagine this is going to affect a lot of people. Possible remedies may include reverting the behavior to removing the lock files, or possibly to create the lock files with the same permissions as the log file (using the configured permissions settings for the appender).

mschout commented 6 years ago

Removing the .LCK files would be a regression (see #7 for details).

Using the same permissions for the lock files seems to be the best option.

mschout commented 6 years ago

This is fixed in v1.36, which I just uploaded to CPAN