From: Jeff A. <je...@se...> - 2011-03-24 17:30:25
|
Jeff McCarrell <jeffmcc <at> yahoo-inc.com> writes: > > Hi folks. > > I'm using log4perl in the obvious way. > We have reqs to set the mode of the log file to 0666. > > using > > log4perl.appender.PUSHD=Log::Dispatch::FileRotate > log4perl.appender.PUSHD.filename=/tmp/pushd.log > log4perl.appender.PUSHD.mode=append > log4perl.appender.PUSHD.permissions = > S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH > # rotate among 5 log files of 10Mbytes each > log4perl.appender.PUSHD.size=100kb > log4perl.appender.PUSHD.max=5 > > results in 5 files of mode 0; > > permissions=0666 gets passed as a string through the layers, not as an > octal number, and results in: > > --w--wx-wT 1 nobody nobody 1063 Nov 2 12:41 pushd.log* > > Anyone have a recipe here that works? > I came across this looking for the same question, I'll throw down the answer I found just for other folks that come looking. the value "0666" is interpreted as a string when it's specified in the file directly. Perl's chmod command requires an actual octal value. To force log4perl to figure this out, explicitly state that the value should be interpreted as Perl code: permissions = sub{0666} That worked just fine for me. --Jeff |