Rotating file log
This commit is contained in:
parent
f15126d0e4
commit
8f7c31a9e5
1 changed files with 12 additions and 0 deletions
|
@ -39,8 +39,20 @@ if __name__ == '__main__':
|
|||
)
|
||||
|
||||
logger = logging.getLogger("hugvey")
|
||||
|
||||
logFileHandler = logging.handlers.RotatingFileHandler(
|
||||
'./recordings/server.log',
|
||||
maxBytes=1024*512,
|
||||
backupCount=5
|
||||
)
|
||||
logFileHandler.setFormatter(logging.Formatter(
|
||||
fmt="%(asctime)s %(name)s[%(process)d,%(threadName)s] %(levelname)s %(message)s"
|
||||
))
|
||||
logger.addHandler(logFileHandler)
|
||||
|
||||
# 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)
|
||||
logger.addHandler(socket_handler)
|
||||
logger.info("Start server")
|
||||
|
||||
|
|
Loading…
Reference in a new issue