pythonwsgieventlet

how to disable eventlet logging? - python


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)


Solution

  • 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"))