The branch, build-main has been updated via 93a9f3f41318e472eb0ac964126a7189f4c80897 (commit) from 4a05d3411c0da68f013201e68b396f77a082344e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: debian/changelog | 1 + sbin/x2gobroker | 6 +++++- x2gobroker/loggers.py | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 0bfda42..4d452a2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ x2gobroker (0.0.0.6-0~x2go1) UNRELEASED; urgency=low fallback to direct PAM authentication (only works if x2gobroker runs as super-user root). - Switch from webpy to using tornado as http engine. + - Divert tornado log requests into the broker's logger instances. * /debian/*.default: - Be more explanatory about the X2GOBROKER_DEBUG option and allow to enable debug mode for the different services independently. diff --git a/sbin/x2gobroker b/sbin/x2gobroker index d9420b0..76173b8 100755 --- a/sbin/x2gobroker +++ b/sbin/x2gobroker @@ -125,9 +125,13 @@ application = tornado.web.Application(urls) # run the web.py standalone daemon... if __name__ == "__main__": try: + settings = { + 'log_function': x2gobroker.loggers.tornado_log_request, + } if x2gobroker.defaults.X2GOBROKER_SSL_CERTFILE and x2gobroker.defaults.X2GOBROKER_SSL_KEYFILE: # switch on https:// mode http_server = tornado.httpserver.HTTPServer(application, + settings=settings, ssl_options={ "certfile": x2gobroker.defaults.X2GOBROKER_SSL_CERTFILE, "keyfile": x2gobroker.defaults.X2GOBROKER_SSL_KEYFILE, @@ -135,7 +139,7 @@ if __name__ == "__main__": ) else: # run without https - http_server = tornado.httpserver.HTTPServer(application) + http_server = tornado.httpserver.HTTPServer(application, settings=settings) http_server.listen(bind_port, address=bind_address) tornado.ioloop.IOLoop.instance().start() except socket.error, e: diff --git a/x2gobroker/loggers.py b/x2gobroker/loggers.py index 5be50f3..fa0e3b1 100644 --- a/x2gobroker/loggers.py +++ b/x2gobroker/loggers.py @@ -70,3 +70,22 @@ else: logger_error = logging.getLogger('error') logger_error.addHandler(stderr_handler) logger_error.propagate = 0 + +def tornado_log_request(self, handler): + """\ + Function for overriding the log_request method in + C{tornado.web.RequestHandler}. + + @param handler: handler + @type handler: C{obj} + + """ + if handler.get_status() < 400: + log_method = logger_access.info + elif handler.get_status() < 500: + log_method = logger_access.warning + else: + log_method = logger_error.error + request_time = 1000.0 * handler.request.request_time() + log_method("%d %s %.2fms", handler.get_status(), + handler._request_summary(), request_time) hooks/post-receive -- x2gobroker.git (HTTP(S) Session broker for X2Go) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).