diff --git a/backend/database/models.py b/backend/database/models.py index dce48dc..761f9fd 100644 --- a/backend/database/models.py +++ b/backend/database/models.py @@ -53,10 +53,10 @@ class Account: def get(account_id: int): import logging logger = logging.getLogger(__name__) - logger.info(f"Account.get called with account_id={account_id}") + logger.debug("Account.get called with account_id=%s", account_id) row = db.execute_one("SELECT * FROM accounts WHERE id = %s", (int(account_id),)) if row: - logger.info(f"Account.get: found account_id={account_id}, name={row.get('name', 'N/A')}, status={row.get('status', 'N/A')}") + logger.debug("Account.get: found account_id=%s, name=%s, status=%s", account_id, row.get('name', 'N/A'), row.get('status', 'N/A')) else: logger.warning(f"Account.get: account_id={account_id} not found in database") return row @@ -135,7 +135,7 @@ class Account: """ import logging logger = logging.getLogger(__name__) - logger.info(f"Account.get_credentials called with account_id={account_id}") + logger.debug("Account.get_credentials called with account_id=%s", account_id) row = Account.get(account_id) if not row: logger.warning(f"Account.get_credentials: account_id={account_id} not found in database") diff --git a/trading_system/main.py b/trading_system/main.py index b099ed9..b8364dc 100644 --- a/trading_system/main.py +++ b/trading_system/main.py @@ -198,12 +198,6 @@ async def main(): if config.USE_DB_CONFIG: logger.info("✓ 使用数据库配置") - # 尝试重新加载配置(确保获取最新值) - try: - config.reload_config() - logger.info("配置已重新加载") - except Exception as e: - logger.warning(f"重新加载配置失败: {e}", exc_info=True) else: logger.warning("⚠ 未使用数据库配置,将使用环境变量和默认配置") logger.warning("如果前端已配置API密钥,请检查:") @@ -211,8 +205,8 @@ async def main(): logger.warning("2. 数据库连接是否正常") logger.warning("3. config_manager模块是否可以正常导入") logger.warning("4. 数据库配置表中是否有BINANCE_API_KEY和BINANCE_API_SECRET") - - # 强制重新加载配置(确保使用最新值) + + # 统一在此重新加载配置(只打一次日志,避免重复) try: config.reload_config() logger.info("配置已重新加载")