How can a process under user id A log to a file under user id B?
This scenario often occurs in configurations where processes run under various user IDs but need to write to a log file under a fixed, but different user id. With a traditional file appender, the log file will probably be created under one user’s id and appended to under a different user’s id. With a typical umask of 0002, the file will be created with -rw-rw-r– permissions. If a user who’s not in the first user’s group subsequently appends to the log file, it will fail because of a permission problem. Two potential solutions come to mind: • Creating the file with a umask of 0000 will allow all users to append to the log file. Log4perl’s file appender Log::Log4perl::Appender::File has an umask option that can be set to support this: log4perl.appender.File = Log::Log4perl::Appender::File log4perl.appender.File.umask = sub { 0000 }; This way, the log file will be created with -rw-rw-rw- permissions and therefore has world write permissions. This might open up the logfile for unwanted ma