Skip to content

Commit 30c400c

Browse files
authored
fix: move log file to parent directory to avoid infinite logging loop (#250)
1 parent 2629ce6 commit 30c400c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ develop-eggs/
2121
dist/
2222
downloads/
2323
eggs/
24-
api/logs/
24+
logs/
2525
.eggs/
2626
lib/
2727
lib64/

api/logging_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def setup_logging(format: str = None):
1010
Ensures log directory exists, and configures both file and console handlers.
1111
"""
1212
# Determine log directory and default file path
13-
base_dir = Path(__file__).parent
13+
# base_dir is now the workspace root
14+
base_dir = Path(__file__).resolve().parent.parent
1415
log_dir = base_dir / "logs"
1516
log_dir.mkdir(parents=True, exist_ok=True)
1617
default_log_file = log_dir / "application.log"

api/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
"api.api:app",
5454
host="0.0.0.0",
5555
port=port,
56-
reload=is_development
56+
reload=is_development,
57+
reload_dirs=["api"] if is_development else None
5758
)

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ services:
1515
- NODE_ENV=production
1616
- SERVER_BASE_URL=http://localhost:${PORT:-8001}
1717
- LOG_LEVEL=${LOG_LEVEL:-INFO}
18-
- LOG_FILE_PATH=${LOG_FILE_PATH:-api/logs/application.log}
18+
- LOG_FILE_PATH=${LOG_FILE_PATH:-logs/application.log}
1919
volumes:
2020
- ~/.adalflow:/root/.adalflow # Persist repository and embedding data
21-
- ./api/logs:/app/api/logs # Persist log files across container restarts
21+
- ./logs:/app/logs # Persist log files across container restarts
2222
# Resource limits for docker-compose up (not Swarm mode)
2323
mem_limit: 6g
2424
mem_reservation: 2g

0 commit comments

Comments
 (0)