summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py9
-rw-r--r--Lib/logging/config.py11
-rw-r--r--Lib/logging/handlers.py4
3 files changed, 13 insertions, 11 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 953afe9..b57a9af 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -214,7 +214,7 @@ class LogRecord:
information to be logged.
"""
def __init__(self, name, level, pathname, lineno,
- msg, args, exc_info, func):
+ msg, args, exc_info, func=None):
"""
Initialize a logging record with interesting information.
"""
@@ -910,10 +910,11 @@ class Manager:
Ensure that children of the placeholder ph are connected to the
specified logger.
"""
- #for c in ph.loggers:
+ name = alogger.name
+ namelen = len(name)
for c in ph.loggerMap.keys():
- # XXX Is the following correct? Shouldn't it be >= 0?
- if string.find(c.parent.name, alogger.name) != 0:
+ #The if means ... if not c.parent.name.startswith(nm)
+ if c.parent.name[:namelen] != name:
alogger.parent = c.parent
c.parent = alogger
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index a31e8d0..a9970d0 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -27,7 +27,7 @@ Copyright (C) 2001-2004 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
-import sys, logging, logging.handlers, string, socket, struct, os, traceback
+import sys, logging, logging.handlers, string, socket, struct, os, traceback, types
try:
import thread
@@ -110,7 +110,7 @@ def _create_formatters(cp):
flist = string.split(flist, ",")
formatters = {}
for form in flist:
- sectname = "formatter_%s" % form
+ sectname = "formatter_%s" % string.strip(form)
opts = cp.options(sectname)
if "format" in opts:
fs = cp.get(sectname, "format", 1)
@@ -139,7 +139,7 @@ def _install_handlers(cp, formatters):
handlers = {}
fixups = [] #for inter-handler references
for hand in hlist:
- sectname = "handler_%s" % hand
+ sectname = "handler_%s" % string.strip(hand)
klass = cp.get(sectname, "class")
opts = cp.options(sectname)
if "formatter" in opts:
@@ -176,6 +176,7 @@ def _install_loggers(cp, handlers):
# configure the root first
llist = cp.get("loggers", "keys")
llist = string.split(llist, ",")
+ llist = map(lambda x: string.strip(x), llist)
llist.remove("root")
sectname = "logger_root"
root = logging.root
@@ -190,7 +191,7 @@ def _install_loggers(cp, handlers):
if len(hlist):
hlist = string.split(hlist, ",")
for hand in hlist:
- log.addHandler(handlers[hand])
+ log.addHandler(handlers[string.strip(hand)])
#and now the others...
#we don't want to lose the existing loggers,
@@ -225,7 +226,7 @@ def _install_loggers(cp, handlers):
if len(hlist):
hlist = string.split(hlist, ",")
for hand in hlist:
- logger.addHandler(handlers[hand])
+ logger.addHandler(handlers[string.strip(hand)])
#Disable any old loggers. There's no point deleting
#them as other threads may continue to hold references
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index a0255ce..17eca8a 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -590,11 +590,11 @@ class SysLogHandler(logging.Handler):
self.address = address
self.facility = facility
if type(address) == types.StringType:
- self._connect_unixsocket(address)
self.unixsocket = 1
+ self._connect_unixsocket(address)
else:
- self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.unixsocket = 0
+ self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.formatter = None