From be1a374b1466e1680d399a1ec3da17830049174e Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 26 Sep 2016 22:16:21 +0800 Subject: [PATCH] Modify log --- terminal/ssh_config.py | 5 +++-- terminal/ssh_server.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/terminal/ssh_config.py b/terminal/ssh_config.py index a23ebbce7..910f7d70d 100644 --- a/terminal/ssh_config.py +++ b/terminal/ssh_config.py @@ -43,10 +43,11 @@ class Config: }, 'file': { 'level': 'DEBUG', - 'class': 'logging.FileHandler', + 'class': 'logging.handlers.TimedRotatingFileHandler', 'formatter': 'main', - 'mode': 'a', 'filename': os.path.join(LOG_DIR, LOG_FILENAME), + 'when': 'D', + 'backupCount': 10, }, }, 'loggers': { diff --git a/terminal/ssh_server.py b/terminal/ssh_server.py index 583d89095..176c31b1c 100644 --- a/terminal/ssh_server.py +++ b/terminal/ssh_server.py @@ -275,6 +275,8 @@ class JumpServer: if backend_channel in r: backend_data = backend_channel.recv(1024) if len(backend_data) == 0: + client_channel.send('Disconnect from %s \r\n' % backend_channel.host) + client_channel.close() logger.info('Logout from backend server %(host)s: %(username)s' % { 'host': backend_channel.host, 'username': backend_channel.username,