Skip to content

Commit eee16d0

Browse files
committed
Use dedicated "kdcproxy" logger
Signed-off-by: Julien Rische <jrische@redhat.com>
1 parent dc3eaba commit eee16d0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

kdcproxy/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import httplib
3939
import urlparse
4040

41+
logger = logging.getLogger('kdcproxy')
42+
4143

4244
class HTTPException(Exception):
4345

@@ -105,7 +107,7 @@ def __await_reply(self, pr, rsocks, wsocks, timeout):
105107
sock.sendall(pr.request)
106108
extra = 10 # New connections get 10 extra seconds
107109
except Exception as e:
108-
logging.warning("Connection broken while writing (%s)", e)
110+
logger.warning("Connection broken while writing (%s)", e)
109111
reactivations[sock] =
110112
(react_n + 1, time.time() + 2.0**(react_n + 1) / 10)
111113
continue
@@ -118,7 +120,7 @@ def __await_reply(self, pr, rsocks, wsocks, timeout):
118120
try:
119121
reply = self.__handle_recv(sock, read_buffers)
120122
except Exception as e:
121-
logging.warning("Connection broken while reading (%s)", e)
123+
logger.warning("Connection broken while reading (%s)", e)
122124
if self.sock_type(sock) == socket.SOCK_STREAM:
123125
# Remove broken TCP socket from readers
124126
rsocks.remove(sock)

kdcproxy/config/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import dns.rdatatype
3333
import dns.resolver
3434

35+
logger = logging.getLogger('kdcproxy')
36+
3537

3638
class IResolver(object):
3739

@@ -60,14 +62,14 @@ def __init__(self, filenames=None):
6062
try:
6163
self.__cp.read(filenames)
6264
except configparser.Error:
63-
logging.error("Unable to read config file(s): %s", filenames)
65+
logger.error("Unable to read config file(s): %s", filenames)
6466

6567
try:
6668
mod = self.__cp.get(self.GLOBAL, "configs")
6769
try:
6870
importlib.import_module("kdcproxy.config." + mod)
6971
except ImportError as e:
70-
logging.log(logging.ERROR, "Error reading config: %s" % e)
72+
logger.log(logging.ERROR, "Error reading config: %s" % e)
7173
except configparser.Error:
7274
pass
7375

0 commit comments

Comments
 (0)