Added exception handling during handler initialization in fileConfig()
This commit is contained in:
parent
1cc37380b2
commit
02dd994adf
|
@ -98,6 +98,7 @@ def fileConfig(fname, defaults=None):
|
|||
handlers = {}
|
||||
fixups = [] #for inter-handler references
|
||||
for hand in hlist:
|
||||
try:
|
||||
sectname = "handler_%s" % hand
|
||||
klass = cp.get(sectname, "class")
|
||||
opts = cp.options(sectname)
|
||||
|
@ -123,6 +124,8 @@ def fileConfig(fname, defaults=None):
|
|||
if len(target): #the target handler may not be loaded yet, so keep for later...
|
||||
fixups.append((h, target))
|
||||
handlers[hand] = h
|
||||
except: #if an error occurs when instantiating a handler, too bad
|
||||
pass #this could happen e.g. because of lack of privileges
|
||||
#now all handlers are loaded, fixup inter-handler references...
|
||||
for fixup in fixups:
|
||||
h = fixup[0]
|
||||
|
|
Loading…
Reference in New Issue