When using a configuration file to initialize a logger, a failure occurs in the logging.config.fileConfig() procedure such that the NTEventLogHandler is not created.
The failure is not observed when the NTEventLogHandler is explicitly defined in a script.
The attached script and two configuration initialization files demonstrate the failure as seen on a Microsoft Windows XP Pro computer running service pack 2 and Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)].
DETAILED DESCRIPTION:
When the attached script is run with EventLog.ini, on my Windows XP computer,
the failure appears to occur at line 118:
h = apply(klass, args)
in File "C:\Python24\lib\logging\config.py" because for:
klass: logging.handlers.NTEventLogHandler
local variable *args* is:
('logging.config.fileConfig bug test')
after line 116:
args = cp.get(sectname, "args")
but local variable *args* is:
logging.config.fileConfig bug test
after line 117:
args = eval(args, vars(logging))
The behavior for the other two handlers is as follows:
klass = logging.StreamHandler
args is: (sys.stdout,) ... after line 116
args is: (<open file '<stdout>', mode 'w' at 0x00A1E068>,) ... after line 117
klass = logging.handlers.TimedRotatingFileHandler
args is: ('fileConfig-test.log', 'midnight', 1, 3) ... after line 116
args is: ('fileConfig-test.log', 'midnight', 1, 3) ... after line 117
|