Fix logging configuration to use flexible log file path

This commit is contained in:
Matteo Benedetto
2025-10-02 16:45:26 +02:00
parent 014d654371
commit 60bad3b7ca
+8 -1
View File
@@ -9,10 +9,17 @@ from fastmcp import FastMCP
import openai
# Configure logging
import tempfile
import os
# Use a temporary directory for logs or current working directory
log_dir = os.environ.get('MCP_LOG_DIR', tempfile.gettempdir())
log_file = os.path.join(log_dir, 'image_server.log')
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
filename='/home/enne2/Sviluppo/mcp-image-server/image_server.log'
filename=log_file
)
logger = logging.getLogger(__name__)