-
Notifications
You must be signed in to change notification settings - Fork 56
MCP-272 Introduce elevated logging #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
MCP-272 Introduce elevated logging #204
Conversation
6652bf1 to
8090f81
Compare
c4df9b6 to
2c7630d
Compare
2c7630d to
498ab1c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces elevated debug logging controlled by the SONARQUBE_ELEVATED_DEBUG environment variable or system property. This feature helps diagnose HTTP communication and tool execution issues by outputting detailed logs to stderr when enabled.
Changes:
- Added
McpLogger.debugElevated()andisElevatedDebugEnabled()methods that check for theSONARQUBE_ELEVATED_DEBUGflag - Implemented
LoggingHttpClientdecorator to log HTTP request/response details (URL, timing, status, body) - Enhanced error handling in
ServerApiHelperandToolExecutorto log additional diagnostic information - Added configuration logging in
HttpClientProviderandSonarQubeMcpServerto output connection settings at startup
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/sonarsource/sonarqube/mcp/log/McpLogger.java | Adds elevated debug logging support with environment/property check |
| src/main/java/org/sonarsource/sonarqube/mcp/http/LoggingHttpClient.java | New decorator that logs HTTP operations when elevated debug is enabled |
| src/main/java/org/sonarsource/sonarqube/mcp/http/HttpClientProvider.java | Wraps HTTP clients with logging decorator and exposes connection settings logging |
| src/main/java/org/sonarsource/sonarqube/mcp/serverapi/ServerApiHelper.java | Logs HTTP error details and refactors response body parsing |
| src/main/java/org/sonarsource/sonarqube/mcp/tools/ToolExecutor.java | Logs tool execution start, end, and error details |
| src/main/java/org/sonarsource/sonarqube/mcp/SonarQubeMcpServer.java | Logs sanitized configuration at startup |
| src/test/java/org/sonarsource/sonarqube/mcp/log/McpLoggerTest.java | Comprehensive test coverage for McpLogger functionality |
| src/test/java/org/sonarsource/sonarqube/mcp/http/LoggingHttpClientTest.java | Test coverage for LoggingHttpClient decorator |
| src/test/java/org/sonarsource/sonarqube/mcp/http/HttpClientProxyTests.java | Adds test for proxy settings logging |
| src/test/java/org/sonarsource/sonarqube/mcp/serverapi/ServerApiTests.java | Adds test for error response body logging |
| src/test/java/org/sonarsource/sonarqube/mcp/SonarQubeMcpServerGenericTest.java | Adds test for configuration logging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/org/sonarsource/sonarqube/mcp/http/LoggingHttpClient.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/http/LoggingHttpClient.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/http/LoggingHttpClient.java
Outdated
Show resolved
Hide resolved
nquinquenel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic is too complex. What I was expecting from this ticket is something way simpler:
- New
SONARQUBE_DEBUG_ENABLEDenv variable (true/false) inMcpServerLaunchConfiguration - Documentation update in
README - New
debug()method in McpLogger - Simple
LOG.debugon various locations we'd like to debug
I don't think we should add this new LoggingHttpClient class
src/main/java/org/sonarsource/sonarqube/mcp/tools/ToolExecutor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/tools/ToolExecutor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/tools/ToolExecutor.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| private void logSanitizedConfig() { | ||
| LOG.debugElevated("=== Sanitized Configuration ==="); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is sanitized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Token is not included
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can come up with a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should change this method's name, maybe logDebugDetails ?
a04dc78 to
caf5635
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/org/sonarsource/sonarqube/mcp/http/HttpClientProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/http/HttpClientProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/serverapi/ServerApiHelper.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/serverapi/ServerApiHelper.java
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/client/McpClientManager.java
Show resolved
Hide resolved
nquinquenel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments. I think we could log more meaningful things, related to tools for example. Maybe in a second time...
src/test/java/org/sonarsource/sonarqube/mcp/log/McpLoggerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/sonarsource/sonarqube/mcp/SonarQubeMcpServerGenericTest.java
Show resolved
Hide resolved
SonarQube reviewer guideSummary: Add configurable debug logging with Review Focus:
Start review at:
|
436238c to
00cdb85
Compare
00cdb85 to
e18344c
Compare




No description provided.