[svn] commit: r2142 - in /branches/trac176/src: bin/xfrout/xfrout.spec.pre.in lib/python/isc/log/log.py lib/python/isc/log/tests/log_test.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Jun 17 09:22:57 UTC 2010
Author: chenzhengzhang
Date: Thu Jun 17 09:22:57 2010
New Revision: 2142
Log:
Fix a bug : user remove log subdirectory at runtime
Modified:
branches/trac176/src/bin/xfrout/xfrout.spec.pre.in
branches/trac176/src/lib/python/isc/log/log.py
branches/trac176/src/lib/python/isc/log/tests/log_test.py
Modified: branches/trac176/src/bin/xfrout/xfrout.spec.pre.in
==============================================================================
--- branches/trac176/src/bin/xfrout/xfrout.spec.pre.in (original)
+++ branches/trac176/src/bin/xfrout/xfrout.spec.pre.in Thu Jun 17 09:22:57 2010
@@ -12,7 +12,7 @@
"item_name": "db_file",
"item_type": "string",
"item_optional": False,
- "item_default": '@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3'
+ "item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/zone.sqlite3"
},
{
"item_name": "log_name",
@@ -24,7 +24,7 @@
"item_name": "log_file",
"item_type": "string",
"item_optional": False,
- "item_default": '@@LOCALSTATEDIR@@/@PACKAGE@/log/Xfrout.log'
+ "item_default": "@@LOCALSTATEDIR@@/@PACKAGE@/log/Xfrout.log"
},
{
"item_name": "log_severity",
Modified: branches/trac176/src/lib/python/isc/log/log.py
==============================================================================
--- branches/trac176/src/lib/python/isc/log/log.py (original)
+++ branches/trac176/src/lib/python/isc/log/log.py Thu Jun 17 09:22:57 2010
@@ -54,6 +54,9 @@
dfn = self.baseFilename
if (self.stream) and (not os.path.exists(dfn)): #Is log file exist?
self.stream.close()
+ dir = os.path.split(dfn)
+ if not (os.path.exists(dir[0])): #Is log subdirectory exist?
+ os.makedirs(dir[0])
self.stream = self._open()
return super(NSFileLogHandler, self).shouldRollover(record)
@@ -71,6 +74,7 @@
self.baseFilename = file_name
self.maxBytes = max_bytes
self.backupCount = backup_count
+
class NSSysLogHandler(logging.Handler):
"""Replace SysLogHandler with a custom handler
Modified: branches/trac176/src/lib/python/isc/log/tests/log_test.py
==============================================================================
--- branches/trac176/src/lib/python/isc/log/tests/log_test.py (original)
+++ branches/trac176/src/lib/python/isc/log/tests/log_test.py Thu Jun 17 09:22:57 2010
@@ -1,7 +1,6 @@
from isc.log.log import *
import unittest
import os
-import sys
import tempfile
@@ -38,9 +37,11 @@
def tearDown(self):
os.close(self.FILE_LOG1[0])
+ os.unlink(self.FILE_LOG1[1])
os.close(self.FILE_LOG2[0])
- os.unlink(self.FILE_LOG1[1])
os.unlink(self.FILE_LOG2[1])
+ os.close(self.FILE_LOG3[0])
+ os.unlink(self.FILE_LOG3[1])
self.handler.flush()
self.handler.close()
More information about the bind10-changes
mailing list