Skip to content

Conversation

anannya03
Copy link
Contributor

What does this PR do?

Enable detailed MCP Server logging for live test visibility.

This change allows tests to capture and attach detailed logs without requiring tools like PerfView or dotnet-trace.
Two mechanisms are now supported:

Verbose logging on STDERR – activated via --verbose, or environment variables (AZMCP_LOG_LEVEL, AZMCP_VERBOSE), allowing the test harness to stream logs in real time.

File-based logging – activated via --log-file or AZMCP_LOG_FILE, which writes logs to a specified file for test attachment.

Adds a lightweight SimpleFileLoggerProvider for writing structured logs to disk.
Improves debuggability and reduces friction during live test runs by making server logs directly accessible through the test harness.

GitHub issue number?

#142

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)

Copy link
Contributor

@Copilot Copilot AI left a 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 enables detailed MCP Server logging for live test visibility by adding comprehensive logging configuration options. The changes allow tests to capture logs through both verbose stderr output and file-based logging without requiring additional debugging tools.

Key changes:

  • Added configurable logging levels and verbose mode through command line options and environment variables
  • Implemented file-based logging with placeholder support for timestamps and process IDs
  • Enhanced logging configuration for both STDIO and HTTP server modes

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
SimpleFileLoggerProvider.cs New lightweight file logger implementation for structured log output
ServiceStartOptions.cs Added logging configuration properties (LogLevel, Verbose, LogFile)
ServiceOptionDefinitions.cs Defined new command line options for logging controls
ServiceStartCommand.cs Integrated logging options with environment variable support and enhanced logging setup
Comments suppressed due to low confidence (1)

core/Azure.Mcp.Core/src/Services/Logging/SimpleFileLoggerProvider.cs:1

  • The Verbose option should be of type Option instead of Option<string?> since it represents a boolean flag. The DefaultValueFactory should return a boolean value false instead of the string "false".
// Copyright (c) Microsoft Corporation.

@anannya03 anannya03 marked this pull request as draft October 13, 2025 04:03
@g2vinay g2vinay added the Do Not Merge Do Not Merge / WIP PRs label Oct 13, 2025
@joshfree joshfree moved this from Untriaged to In Progress in Azure MCP Server Oct 14, 2025
@joshfree joshfree added this to the 2025-11 milestone Oct 14, 2025
@anannya03 anannya03 force-pushed the live-tests-debug_logs branch from 84b2be2 to dffbee1 Compare October 15, 2025 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Do Not Merge / WIP PRs

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants