Commit 1ca882e
Andrey Barchenkov
fix: move logging configuration from MCPServer.__init__ to run()
MCPServer.__init__() called configure_logging() which invokes
logging.basicConfig(), adding handlers and setting the level on the root
logger. This violates the Python logging best practice that library code
should never configure the root logger — only application entrypoints
should do that.
Applications embedding MCPServer as a library had their logging config
silently overwritten at import/construction time.
Move configure_logging() to run(), which is the application entrypoint
for standalone server processes. Library consumers who instantiate
MCPServer directly now keep full control of their logging setup.
Fixes #16561 parent 3d7b311 commit 1ca882e
2 files changed
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
| |||
291 | 288 | | |
292 | 289 | | |
293 | 290 | | |
| 291 | + | |
| 292 | + | |
294 | 293 | | |
295 | 294 | | |
296 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1516 | 1516 | | |
1517 | 1517 | | |
1518 | 1518 | | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
0 commit comments