From 24fc6a0826584771bba83fa0381b0af4f49ce54b Mon Sep 17 00:00:00 2001 From: aronwk-aaron Date: Fri, 16 Dec 2022 22:50:43 -0600 Subject: [PATCH] move logs to folder --- app/__init__.py | 2 +- app/log.py | 2 +- logs/.gitkeep | 0 wsgi.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 logs/.gitkeep diff --git a/app/__init__.py b/app/__init__.py index 6b0a4af..9274fd2 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -159,7 +159,7 @@ def register_blueprints(app): def register_logging(app): # file logger - file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20) + file_handler = RotatingFileHandler('logs/nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20) file_handler.setLevel(logging.INFO) formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") file_handler.setFormatter(formatter) diff --git a/app/log.py b/app/log.py index 44cc54a..f08ac10 100644 --- a/app/log.py +++ b/app/log.py @@ -25,7 +25,7 @@ def command(): @log_blueprint.route('/system') @gm_level(8) def system(): - with open('nexus_dashboard.log', 'r') as file: + with open('logs/nexus_dashboard.log', 'r') as file: logs = '
'.join(file.read().split('\n')[-100:]) return render_template('logs/system.html.j2', logs=logs) diff --git a/logs/.gitkeep b/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/wsgi.py b/wsgi.py index 90d13e0..9096484 100644 --- a/wsgi.py +++ b/wsgi.py @@ -18,7 +18,7 @@ else: from logging.handlers import RotatingFileHandler gunicorn_logger = logging.getLogger('gunicorn.error') app.logger.handlers = gunicorn_logger.handlers - file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20) + file_handler = RotatingFileHandler('logs/nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20) formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") file_handler.setFormatter(formatter) app.logger.addHandler(file_handler)