Commit 8cd3eaf9 authored by Jerry's avatar Jerry
Browse files

Modified exception handler



git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac176@1963 e5f2f494-b856-4b98-b285-d166d9295462
parent c37b820b
......@@ -56,19 +56,17 @@ class RotatingFileHandler(logging.handlers.RotatingFileHandler):
"""
Update RotatingFileHandler configuration.
If the file path is not exists, we will use the old configuration.
input:
log file name
max backup count
predetermined log file size
"""
try:
self._open(file_name)
except IOError:
print("The file path is not exist!")
return
self.baseFilename = file_name
self.maxBytes = max_bytes
self.backupCount = backup_count
dir = os.path.split(file_name)
if(os.path.exists(dir[0])):
self.baseFilename = file_name
self.maxBytes = max_bytes
self.backupCount = backup_count
class SLHandler(logging.Handler):
"""
......@@ -194,8 +192,8 @@ class ModuleLogger(logging.getLoggerClass()):
def update_rotate_handler(self, log_file, max_bytes, backup_count):
"""
If rotate handler has been added to the logger, update its configuration,
else add it to logger.
If the rotate handler has been added to the logger, update its configuration,
else add it to the logger.
If log file is empty, the handler will be removed.
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment