BIND 10 #267: python log shouldn't die with OSError
BIND 10 Development
do-not-reply at isc.org
Fri Sep 17 12:29:57 UTC 2010
#267: python log shouldn't die with OSError
--------------------------+-------------------------------------------------
Reporter: jinmei | Owner: stephen
Type: defect | Status: reviewing
Priority: major | Milestone: 06. 4th Incremental Release
Component: logging | Resolution:
Keywords: | Sensitive: 0
Estimatedhours: 0.0 | Hours:
Billable: 1 | Totalhours:
Internal: 0 |
--------------------------+-------------------------------------------------
Changes (by zzchen_pku):
* owner: zzchen_pku => stephen
Comment:
Replying to [comment:16 stephen]:
> '''src/lib/python/isc/log/log.py'''
> ''!__init!__'' and ''shouldRollover()''
> Are we absolutely sure that "filename" contains a directory component at
this point? If given as just a bare filename (e.g. "log.txt"), then
os.path.split() will return the empty string as its first element and the
subsequent call to os.makedirs() will fail.
Added NSFileLogHandler._get_abs_file_path() to get absolute file path.
> Remark: "dir" (used to hold the result of os.path.split()) is the name
of a built-in Python function. Its use as a variable is OK, but it is
highlighted when I look at the file with an editor that does syntax
colouring.
Done, should avoid use build-in python fuction as variable name.
> I don't think that the comments have quite the level of detail that
Jinmei wanted. I think the essence of the question is why create the
directories? Most other applications will fail if the directory does not
exist.
> Remark: I think that the location of the directory creation is OK - when
the handler is initialized and whenever there is a possibility that the
logging system will write to a different file. Changes made via a call to
update_config() will be picked up in the next call to shouldRollover().
(Incidentally, a comment to that effect in update_config() would be
useful.)
Updated.
> '''src/lib/python/isc/log/tests/log_test.py'''
> ''General''
Done.
> ''Class !TestSysLogHandler''
> test_emit(): This only checks that the emit() call does not fail - it
does not check that the record has been sent to the syslog stream.
The destination of syslog stream depends on OS type and syslog.conf, so it
is difficult to trace and check the log message. Do you have any good
suggestions?
Thank you for your comments.
--
Ticket URL: <http://bind10.isc.org/ticket/267#comment:17>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list