ryu.lib.hub: add logging wrapper for wsgi server
This patch adds a wrapper to relay the log of the wsgi server to the logger. Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
78a9a20270
commit
8d6f150b58
@ -120,9 +120,14 @@ if HUB_TYPE == 'eventlet':
|
||||
sock, addr = self.server.accept()
|
||||
spawn(self.handle, sock, addr)
|
||||
|
||||
class LoggingWrapper(object):
|
||||
def write(self, message):
|
||||
LOG.info(message.rstrip('\n'))
|
||||
|
||||
class WSGIServer(StreamServer):
|
||||
def serve_forever(self):
|
||||
eventlet.wsgi.server(self.server, self.handle)
|
||||
self.logger = LoggingWrapper()
|
||||
eventlet.wsgi.server(self.server, self.handle, self.logger)
|
||||
|
||||
WebSocketWSGI = websocket.WebSocketWSGI
|
||||
|
||||
|
@ -72,7 +72,7 @@ def init_log():
|
||||
if CONF.log_config_file:
|
||||
try:
|
||||
logging.config.fileConfig(CONF.log_config_file,
|
||||
disable_existing_loggers=True)
|
||||
disable_existing_loggers=False)
|
||||
except ConfigParser.Error as e:
|
||||
print('Failed to parse %s: %s' % (CONF.log_config_file, e),
|
||||
file=sys.stderr)
|
||||
|
Loading…
Reference in New Issue
Block a user