From 0e3ae6a8f8a5afa60be94c1e1d7b91165c6f36e2 Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 25 Jun 2025 16:05:02 +0800 Subject: [PATCH] feat: add MAXKB_LOG_LEVEL env. --- apps/maxkb/conf.py | 3 +++ apps/maxkb/settings/logging.py | 2 +- installer/Dockerfile-base | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/maxkb/conf.py b/apps/maxkb/conf.py index f960caffe..71fa4e87b 100644 --- a/apps/maxkb/conf.py +++ b/apps/maxkb/conf.py @@ -81,6 +81,9 @@ class Config(dict): def get_language_code(self): return self.get('LANGUAGE_CODE', 'zh-CN') + def get_log_level(self): + return self.get('LOG_LEVEL', 'DEBUG') + def __init__(self, *args): super().__init__(*args) diff --git a/apps/maxkb/settings/logging.py b/apps/maxkb/settings/logging.py index b8b2709e9..5ef1d1cd1 100644 --- a/apps/maxkb/settings/logging.py +++ b/apps/maxkb/settings/logging.py @@ -7,7 +7,7 @@ from ..const import PROJECT_DIR, CONFIG, LOG_DIR MAX_KB_LOG_FILE = os.path.join(LOG_DIR, 'maxkb.log') DRF_EXCEPTION_LOG_FILE = os.path.join(LOG_DIR, 'drf_exception.log') UNEXPECTED_EXCEPTION_LOG_FILE = os.path.join(LOG_DIR, 'unexpected_exception.log') -LOG_LEVEL = "DEBUG" +LOG_LEVEL = CONFIG.get_log_level() LOGGING = { 'version': 1, diff --git a/installer/Dockerfile-base b/installer/Dockerfile-base index 7d5236c40..29b99d993 100644 --- a/installer/Dockerfile-base +++ b/installer/Dockerfile-base @@ -31,4 +31,5 @@ ENV PGDATA=/opt/maxkb/data/postgresql/pgdata \ POSTGRES_PASSWORD=Password123@postgres \ POSTGRES_MAX_CONNECTIONS=1000 \ REDIS_PASSWORD=Password123@redis \ - LANG=en_US.UTF-8 + LANG=en_US.UTF-8 \ + MAXKB_LOG_LEVEL=INFO