Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

fix: use stderr for logging

Ben Sully4e4436687b00
diff --git a/src/fastmcp/utilities/logging.py b/src/fastmcp/utilities/logging.py
index e2dd5f45e..1535d1e56 100644
--- a/src/fastmcp/utilities/logging.py
+++ b/src/fastmcp/utilities/logging.py
@@ -3,6 +3,7 @@
import logging
from typing import Literal
+from rich.console import Console
from rich.logging import RichHandler
@@ -27,5 +28,7 @@ def configure_logging(
level: the log level to use
"""
logging.basicConfig(
- level=level, format="%(message)s", handlers=[RichHandler(rich_tracebacks=True)]
+ level=level,
+ format="%(message)s",
+ handlers=[RichHandler(console=Console(stderr=True), rich_tracebacks=True)],
)