Fix logging configuration to use flexible log file path
This commit is contained in:
@@ -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__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user