I have a standard Magento application where actions are performed either through web (www-data) or cron scripts (executed by a cron user). By default, Magento creates log files with chmod 0640 so this gives us a problem. Whoever logs an exception/system first (www-data or cron), the other won't be able to append. So if an exception occurs on the web, the var/log/exception.log will be created with www-data as owner so cron scripts won't be able to log exceptions in the same file (cron and www-data are not in the same group but even if they would be, it wouldn't help).
Possible solutions: 1. Run cron with same www-data user (sysadmin won't budge, doesn't agree with the solution) 2. Change Mage.php to generate the log files with a more suitable chmod (even 777 maybe). Doable but this means modifying Magento core files (Mage.php) and it's not really allowed by license.
Mage class is final and I noticed there is no pre- or post- events after logging in order to possible change the chmod in a pre/post hook.
Has anybody encountered the same problem or has any advice on how to properly handle this?