wingo - in flumotion/trunk: . doc/redhat flumotion/common
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Mon Jan 22 17:59:13 CET 2007
Author: wingo
Date: Mon Jan 22 17:59:09 2007
New Revision: 4421
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/doc/redhat/flumotion.logrotate
flumotion/trunk/flumotion/common/log.py
Log:
2007-01-22 Andy Wingo <wingo at pobox.com>
* doc/redhat/flumotion.logrotate: Add some more logrotate options.
* flumotion/common/log.py (reopenOutputFiles): When rotating,
create files with a 0640 mask.
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Mon Jan 22 17:59:09 2007
@@ -1,5 +1,10 @@
2007-01-22 Andy Wingo <wingo at pobox.com>
+ * doc/redhat/flumotion.logrotate: Add some more logrotate options.
+
+ * flumotion/common/log.py (reopenOutputFiles): When rotating,
+ create files with a 0640 mask.
+
* flumotion.spec.in:
* doc/Makefile.am (EXTRA_DIST):
* doc/redhat/flumotion.logrotate: Install a logrotate file.
Modified: flumotion/trunk/doc/redhat/flumotion.logrotate
==============================================================================
--- flumotion/trunk/doc/redhat/flumotion.logrotate (original)
+++ flumotion/trunk/doc/redhat/flumotion.logrotate Mon Jan 22 17:59:09 2007
@@ -1,9 +1,15 @@
-/var/log/flumotion/* {
+/var/log/flumotion/*.log {
missingok
notifempty
+ dateext
+ sharedscripts
+ nocreate
+ weekly
+ # keep 4 weeks of data
+ rotate 4
postrotate
find /var/run/flumotion -type f -print | while read f; do
- /usr/bin/kill -HUP `cat $f` 2>/dev/null || true
+ /usr/bin/kill -HUP `cat $f 2>/dev/null` 2>/dev/null || true
done
endscript
}
Modified: flumotion/trunk/flumotion/common/log.py
==============================================================================
--- flumotion/trunk/flumotion/common/log.py (original)
+++ flumotion/trunk/flumotion/common/log.py Mon Jan 22 17:59:09 2007
@@ -585,10 +585,18 @@
debug('log', 'told to reopen log files, but log files not set')
return
- so = open(_stdout, 'a+')
- se = open(_stderr, 'a+', 0)
- os.dup2(so.fileno(), sys.stdout.fileno())
- os.dup2(se.fileno(), sys.stderr.fileno())
+ so = os.open(_stdout, os.O_APPEND|os.O_CREAT, 0640)
+
+ # Attempt to make stderr unbuffered while still keeping 640 perms if
+ # we create a new file. Would do this a different way if setvbuf(2)
+ # were available directly in python...
+ if _stdout == _stderr:
+ se = open(_stderr, 'a+', 0).fileno()
+ else:
+ se = os.open(_stderr, os.O_APPEND|os.O_CREAT, 0640)
+
+ os.dup2(so, sys.stdout.fileno())
+ os.dup2(se, sys.stderr.fileno())
debug('log', 'opened log %r', _stderr)
def outputToFiles(stdout, stderr):
More information about the flumotion-commit
mailing list