Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: add file log (#3612)
liuzhenghua73e9f35ab1dc
diff --git a/api/app.py b/api/app.pyindex bd782a43802..23274c307cf 100644--- a/api/app.py+++ b/api/app.py@@ -1,4 +1,6 @@import os+import sys+from logging.handlers import RotatingFileHandlerif not os.environ.get("DEBUG") or os.environ.get("DEBUG").lower() != 'true':from gevent import monkey@@ -86,7 +88,25 @@ def create_app(test_config=None) -> Flask:app.secret_key = app.config['SECRET_KEY']- logging.basicConfig(level=app.config.get('LOG_LEVEL', 'INFO'))+ log_handlers = None+ log_file = app.config.get('LOG_FILE')+ if log_file:+ log_dir = os.path.dirname(log_file)+ os.makedirs(log_dir, exist_ok=True)+ log_handlers = [+ RotatingFileHandler(+ filename=log_file,+ maxBytes=1024 * 1024 * 1024,+ backupCount=5+ ),+ logging.StreamHandler(sys.stdout)+ ]+ logging.basicConfig(+ level=app.config.get('LOG_LEVEL'),+ format=app.config.get('LOG_FORMAT'),+ datefmt=app.config.get('LOG_DATEFORMAT'),+ handlers=log_handlers+ )initialize_extensions(app)register_blueprints(app)diff --git a/api/config.py b/api/config.pyindex 631be4bbb57..472ee7aff8b 100644--- a/api/config.py+++ b/api/config.py@@ -38,6 +38,9 @@ DEFAULTS = {'QDRANT_CLIENT_TIMEOUT': 20,'CELERY_BACKEND': 'database','LOG_LEVEL': 'INFO',+ 'LOG_FILE': '',+ 'LOG_FORMAT': '%(asctime)s.%(msecs)03d %(levelname)s [%(threadName)s] [%(filename)s:%(lineno)d] - %(message)s',+ 'LOG_DATEFORMAT': '%Y-%m-%d %H:%M:%S','HOSTED_OPENAI_QUOTA_LIMIT': 200,'HOSTED_OPENAI_TRIAL_ENABLED': 'False','HOSTED_OPENAI_TRIAL_MODELS': 'gpt-3.5-turbo,gpt-3.5-turbo-1106,gpt-3.5-turbo-instruct,gpt-3.5-turbo-16k,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-0613,gpt-3.5-turbo-0125,text-davinci-003',@@ -107,6 +110,9 @@ class Config:self.DEPLOY_ENV = get_env('DEPLOY_ENV')self.TESTING = Falseself.LOG_LEVEL = get_env('LOG_LEVEL')+ self.LOG_FILE = get_env('LOG_FILE')+ self.LOG_FORMAT = get_env('LOG_FORMAT')+ self.LOG_DATEFORMAT = get_env('LOG_DATEFORMAT')# The backend URL prefix of the console API.# used to concatenate the login authorization callback or notion integration callback.