-
Couldn't load subscription status.
- Fork 5
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Overview
MCPcat currently writes debug logs to a mcpcat.log file by default. In production environments or when debugging is not needed, this can create unnecessary disk I/O and storage usage. We need a way to control whether logs are written to file.
Current State
The logging module (src/mcpcat/modules/logging.py) automatically writes all debug information to a log file. There's no configuration option to disable this behavior, which can be problematic for:
- Production deployments where disk I/O should be minimized
- Containerized environments with limited storage
- Situations where logging is handled by external systems
Requirements
Add a configuration option to control file logging:
-
New Configuration Option
- Add a
debug_modeorenable_file_loggingflag to MCPCatOptions - Default to current behavior (logging enabled) for backward compatibility
- Add a
-
Conditional Logging
- Only write to file when explicitly enabled
- Preserve all other logging functionality
-
Environment Variable Support
- Allow setting via environment variable (e.g.,
MCPCAT_DEBUG_MODE) - Useful for containerized deployments
- Allow setting via environment variable (e.g.,
Why This Matters
- Reduces unnecessary disk I/O in production
- Prevents log files from filling up disk space
- Gives users control over their logging strategy
- Improves performance when debugging isn't needed
- Better suits cloud-native deployments
Acceptance Criteria
- Add configuration option to MCPCatOptions
- Modify write_to_log function to check configuration
- Support environment variable override
- Maintain backward compatibility (default to enabled)
- Update documentation with new option
- Add tests for both enabled and disabled states
Getting Started
- Look at the MCPCatOptions class structure
- Find the write_to_log function in logging module
- Add conditional check before file operations
- Consider using environment variables with os.getenv
- Test both configurations thoroughly
Configuration Examples
The option should support patterns like:
# Disable file logging
track(server, project_id="...", options={
"debug_mode": False # or "enable_file_logging": False
})
# Via environment variable
MCPCAT_DEBUG_MODE=falseNotes
- Consider what happens to existing log files when disabled
- Think about whether to log this configuration choice itself
- Ensure error handling still works when logging is disabled
- Keep the implementation simple and performant
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed