COUNTERKILL
COUNTERKILL

Reputation: 173

Python tornado handler warnings disabling

I was define head method in tornado handler to check file exists:

def head(self, path):
    if file_isset(path):
        self.set_status(200)
    else:
        self.set_status(404)

But tornado writes message such as WARNING:tornado.access:404 HEAD /file_name to terminal. How to disable this message?

Upvotes: 2

Views: 999

Answers (1)

afxentios
afxentios

Reputation: 2568

You can disable the logger tornado.access prior the start of the IOLoop using logging.getLogger('tornado.access').disabled = True.

For example:

def main():
    logging.getLogger('tornado.access').disabled = True
    app = Application()
    http_server = HTTPServer(app)
    http_server.listen(options.port, address=options.host)
    IOLoop.instance().start()

Upvotes: 4

Related Questions