Commit 874bde1
committed
fix: move logging configuration from MCPServer.__init__ to run()
MCPServer.__init__() called configure_logging() which invokes
logging.basicConfig(), configuring the root logger with handlers
and level on every instantiation. This violates Python's logging
best practice for libraries: library code must never configure
logging — only application entrypoints should.
Move configure_logging() to run(), which is the actual application
entrypoint. MCPServer used as a library no longer has logging side
effects.
Github-Issue: #1656
Reported-by: SimonZehetner1 parent 62eb08e commit 874bde1
File tree
2 files changed
+16
-3
lines changed- src/mcp/server/mcpserver
- tests/server/mcpserver
2 files changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 197 | | |
201 | 198 | | |
202 | 199 | | |
| |||
278 | 275 | | |
279 | 276 | | |
280 | 277 | | |
| 278 | + | |
| 279 | + | |
281 | 280 | | |
282 | 281 | | |
283 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1481 | 1481 | | |
1482 | 1482 | | |
1483 | 1483 | | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
0 commit comments