how to disable eventlet logging? – python

Question:

i need to disable the logging in eventlet for a WSGI server, i tried several things i found online, nothing worked

code :

import eventlet
import socketio
import logging


sio= socketio.Server()

app = socketio.WSGIApp(sio, static_files={
    '/': {'content_type': 'text/html', 'filename': '/home/*****/SecChat/index.html'}
})

#<site functionality (i deleted the code here as its not related)>

if __name__ == '__main__':
    eventlet.wsgi.server(eventlet.listen(('', 5000)), app)

Asked By: Shards-7

||

Answers:

eventlet.wsgi.server() accepts the log parameter. It accepts both a logger object and a writable file-like object. You can try sending the data to /dev/null with:

if __name__ == '__main__':
    eventlet.wsgi.server(eventlet.listen(('', 5000)), app, log=open(os.devnull,"w"))
Answered By: kichik
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.