From aeab4ded6e29c134b31d7355005c8f7720624a95 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Sat, 11 Apr 2020 14:33:40 -0400 Subject: [PATCH] Add fix for logrotation (#1311) * Bump max log file size to 10 MB and fix log rotation on RotatingFileHandler * Closes #1302 --- CTFd/utils/initialization/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CTFd/utils/initialization/__init__.py b/CTFd/utils/initialization/__init__.py index b09660d..f6aef67 100644 --- a/CTFd/utils/initialization/__init__.py +++ b/CTFd/utils/initialization/__init__.py @@ -102,11 +102,13 @@ def init_logs(app): open(log, "a").close() submission_log = logging.handlers.RotatingFileHandler( - logs["submissions"], maxBytes=10000 + logs["submissions"], maxBytes=10485760, backupCount=5 + ) + login_log = logging.handlers.RotatingFileHandler( + logs["logins"], maxBytes=10485760, backupCount=5 ) - login_log = logging.handlers.RotatingFileHandler(logs["logins"], maxBytes=10000) registration_log = logging.handlers.RotatingFileHandler( - logs["registrations"], maxBytes=10000 + logs["registrations"], maxBytes=10485760, backupCount=5 ) logger_submissions.addHandler(submission_log)