Skip to content

Commit 9e8f03e

Browse files
author
zyuuzika
committed
fix: per-process app log to avoid WinError 32 on rotate (multi-worker)
Made-with: Cursor
1 parent fbbd095 commit 9e8f03e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
ACTIVE_AUTH_DIR = os.path.join(AUTH_PROFILES_DIR, 'active')
2020
SAVED_AUTH_DIR = os.path.join(AUTH_PROFILES_DIR, 'saved')
2121
LOG_DIR = os.path.join(PROJECT_ROOT, 'logs')
22-
APP_LOG_FILE_PATH = os.path.join(LOG_DIR, 'app.log')
22+
# One shared app.log + RotatingFileHandler across uvicorn workers fails on Windows (WinError 32 on rotate).
23+
APP_LOG_FILE_PATH = os.path.join(LOG_DIR, f'app-{os.getpid()}.log')
2324

2425
# 工具函数
2526
def get_environment_variable(key: str, default: str='') -> str:

0 commit comments

Comments
 (0)