Add logbuffer for file
This commit is contained in:
parent
1501b9f820
commit
de82f73363
1 changed files with 4 additions and 2 deletions
|
@ -50,11 +50,13 @@ if __name__ == '__main__':
|
|||
fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
|
||||
))
|
||||
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
|
||||
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)
|
||||
logger.info("Start server")
|
||||
|
||||
|
|
Loading…
Reference in a new issue