From: John O. <joh...@o-...> - 2007-02-23 21:22:10
|
Hi Martin, I can't help but I'll be watching for answers because I'm seeing a possibly related problem when using FileRotate initialised from a config file called by Apache. I have a mod_perl app which is loaded during Apache startup (while Apache is root) which calls init_and_watch. If I have my FileRotate log going at startup, only the server startup messages get written because the child processes run as 'apache' which doesn't have permission to write to the file create by Apache while it was root. As a workaround I have it commented out in my log4perl config on startup then I un-comment it and init_and_watch catches the change and starts writing. Obviously there are a few solutions but I've yet to choose a 'neat' solution. John Martin Evans wrote: > Hi, > > I've been using Log::Log4perl for ages now in a set of CPAN modules we > wrote and internally in a project here. All has been ok, it works well - > thank you. > > This issue is mostly related to Log::Dispatch::FileRotate|File but I am > posting here since I may need advice on an alternative. > > Our log files are getting pretty large and after seeing a post on this > list I decided to try Log::Dispatch::FileRotate. It seemed to work fine > at first. The logging is in a single module, this module is used in > multiple places/processes under different uids and we have a single > config file. One of the places is code running under modperl, the other > is a daemon in perl. > > The first problem was due to umasks and first to start (the daemon or > modperl) created the file and the other couldn't open it. I tried > > log4perl.appender.X1.umask = sub { 0000 } > > but it would seem Log::Dispatch::FileRotate does not know umask. I then > discovered "permissions" so did: > > log4perl.appender.X1.permissions = sub { 0666 } > > and this appears to work until another uid comes along in which case you > get: > > Cannot chmod /tmp/dbix.log to 438: Operation not permitted at > /usr/lib/perl5/site_perl/5.8.8/Log/Dispatch/File.pm line 96 > > I don't get this as Log::Dispatch::File says: > > "If the file does not already exist, the permissions that it should be > created with." > > so I presume this is a bug. > > Am I wasting my time here? Would I be better going back to > Log::Log4perl::Appender::File, using ".umask" and some external file > rotator? Any recommendations? > > Martin > |