Add logbuffer for file

This commit is contained in:
Ruben van de Ven 2019-11-14 20:17:46 +01:00
parent 1501b9f820
commit de82f73363

View file

@ -50,11 +50,13 @@ if __name__ == '__main__':
fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s" fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
)) ))
logFileHandler.setLevel(logging.DEBUG) logFileHandler.setLevel(logging.DEBUG)
rootLogger.addHandler(logFileHandler) # Buffer the writing to disk, to make it more efficient
memBufferHandler = logging.handlers.MemoryHandler(200, flushLevel=logging.ERROR, target=logFileHandler, flushOnClose=True)
rootLogger.addHandler(memBufferHandler)
# logger.setLevel(1) # to send all records to cutelog # logger.setLevel(1) # to send all records to cutelog
socket_handler = logging.handlers.SocketHandler('127.0.0.1', 19996) # default listening address socket_handler = logging.handlers.SocketHandler('127.0.0.1', 19996) # default listening address
socket_handler.setLevel(logging.DEBUG) socket_handler.setLevel(logging.INFO) # OR should it be DEBUG? chaned to see difference in logging speed
rootLogger.addHandler(socket_handler) rootLogger.addHandler(socket_handler)
logger.info("Start server") logger.info("Start server")