[PR #259] [MERGED] feat: make log level adjustable #216

Closed
opened 2026-02-15 21:15:21 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/mcpo/pull/259
Author: @diseku
Created: 10/9/2025
Status: Merged
Merged: 10/14/2025
Merged by: @tjbck

Base: devHead: feat/adjustable_log_level


📝 Commits (1)

  • 7a301ca feat: make log level adjustable

📊 Changes

2 files changed (+21 additions, -3 deletions)

View changed files

📝 src/mcpo/__init__.py (+7 -0)
📝 src/mcpo/main.py (+14 -3)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • Added configurable logging levels via LOG_LEVEL environment variable to reduce log noise in production environments. The feature allows users to control the verbosity of both Python application logs and uvicorn server logs through a single environment variable or CLI option.

Added

  • LOG_LEVEL environment variable support with default value of "INFO"
  • --log-level CLI option to override the environment variable
  • Support for all standard Python logging levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Graceful handling of invalid log levels with warning message and fallback to INFO
  • Consistent log level configuration for both Python logging and uvicorn server

Changed

  • Logging configuration in main.py now reads from LOG_LEVEL environment variable instead of being hardcoded to INFO
  • Uvicorn server log level now dynamically configured based on LOG_LEVEL environment variable
  • CLI interface enhanced with new --log-level option for runtime log level control

Deprecated

  • N/A

Removed

  • N/A

Fixed

  • N/A

Security

  • N/A

Breaking Changes

  • No breaking changes - The implementation maintains backward compatibility with existing deployments

Additional Information

  • Environment Variable: LOG_LEVEL (defaults to "INFO")
  • CLI Option: --log-level (overrides environment variable)
  • Supported Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Docker Compatibility: Works seamlessly with existing Dockerfile without modifications
  • Testing: Comprehensive testing performed with all log levels and invalid values

Usage Examples

# Using environment variable
export LOG_LEVEL=WARNING
mcpo --config config.json

# Using CLI option (overrides environment variable)
mcpo --log-level ERROR --config config.json

# Reduce log noise in production
export LOG_LEVEL=ERROR
mcpo --config config.json

# Docker usage
docker run -e LOG_LEVEL=WARNING your-mcpo-image --config /path/to/config.json

Screenshots or Videos

  • N/A (logging configuration changes are not visually demonstrable)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/mcpo/pull/259 **Author:** [@diseku](https://github.com/diseku) **Created:** 10/9/2025 **Status:** ✅ Merged **Merged:** 10/14/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `feat/adjustable_log_level` --- ### 📝 Commits (1) - [`7a301ca`](https://github.com/open-webui/mcpo/commit/7a301cad984897b438bf3da6d4912f66fee70da1) feat: make log level adjustable ### 📊 Changes **2 files changed** (+21 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/mcpo/__init__.py` (+7 -0) 📝 `src/mcpo/main.py` (+14 -3) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests to validate the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - Added configurable logging levels via LOG_LEVEL environment variable to reduce log noise in production environments. The feature allows users to control the verbosity of both Python application logs and uvicorn server logs through a single environment variable or CLI option. ### Added - **LOG_LEVEL environment variable support** with default value of "INFO" - **--log-level CLI option** to override the environment variable - **Support for all standard Python logging levels**: DEBUG, INFO, WARNING, ERROR, CRITICAL - **Graceful handling of invalid log levels** with warning message and fallback to INFO - **Consistent log level configuration** for both Python logging and uvicorn server ### Changed - **Logging configuration in main.py** now reads from LOG_LEVEL environment variable instead of being hardcoded to INFO - **Uvicorn server log level** now dynamically configured based on LOG_LEVEL environment variable - **CLI interface** enhanced with new --log-level option for runtime log level control ### Deprecated - N/A ### Removed - N/A ### Fixed - N/A ### Security - N/A ### Breaking Changes - **No breaking changes** - The implementation maintains backward compatibility with existing deployments --- ### Additional Information - **Environment Variable**: `LOG_LEVEL` (defaults to "INFO") - **CLI Option**: `--log-level` (overrides environment variable) - **Supported Values**: DEBUG, INFO, WARNING, ERROR, CRITICAL - **Docker Compatibility**: Works seamlessly with existing Dockerfile without modifications - **Testing**: Comprehensive testing performed with all log levels and invalid values ### Usage Examples ```bash # Using environment variable export LOG_LEVEL=WARNING mcpo --config config.json # Using CLI option (overrides environment variable) mcpo --log-level ERROR --config config.json # Reduce log noise in production export LOG_LEVEL=ERROR mcpo --config config.json # Docker usage docker run -e LOG_LEVEL=WARNING your-mcpo-image --config /path/to/config.json ``` ### Screenshots or Videos - N/A (logging configuration changes are not visually demonstrable) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 21:15:21 -05:00
yindo closed this issue 2026-02-15 21:15:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/mcpo#216