Skip to content

fix: logging configuration handling#1023

Merged
friedrichwilken merged 6 commits intokyma-project:mainfrom
friedrichwilken:fix_logging_2026Feb23
Feb 24, 2026
Merged

fix: logging configuration handling#1023
friedrichwilken merged 6 commits intokyma-project:mainfrom
friedrichwilken:fix_logging_2026Feb23

Conversation

@friedrichwilken
Copy link
Contributor

Description

Changes proposed in this pull request:

  • fix handling of logging configuration ourside of dev mode

Related issue(s)

@github-actions
Copy link

Note(s) for PR Auther:

  • The integration test will be skipped for the PR. You can trigger it manually after adding the label: run-integration-test.
  • The evaluation test will be skipped for the PR. You can trigger it manually after adding the label: evaluation requested.
  • If any changes are made to the evaluation tests data, make sure that the integration tests are working as expected.
  • If any changes are made to how to run the unit tests, make sure to update the steps for unit-tests in the create-release.yml workflow as well.

Note(s) for PR Reviewer(s):

  • Make sure that the integration and evaluation tests are working as expected.

@hyperspace-insights
Copy link
Contributor

hyperspace-insights bot commented Feb 23, 2026

Summary

The following content is AI-generated and provides a summary of the pull request:


Fix Logging Configuration Handling

Bug Fix

🐛 Bug Fix: Resolved logging configuration issues when running outside of development mode.

Changes

This pull request addresses logging configuration problems that occurred when the application was not running in development mode. The changes ensure proper logging behavior across different runtime environments.

  • main.py:
    • Added asynccontextmanager and AsyncGenerator imports to support the new lifespan event handler
    • Imported reconfigure_logging function from utils.logging module
    • Implemented a lifespan event handler that reconfigures logging after uvicorn starts, with special handling to skip reconfiguration during pytest runs
    • Integrated the lifespan handler with the FastAPI application
    • Updated the main entry point to disable uvicorn's default log configuration in favor of custom logging setup
    • Made host and port configurable via environment variables (HOST and PORT)

The fix ensures that logging configuration is properly applied after uvicorn initializes, preventing conflicts between uvicorn's built-in logging and the application's custom logging setup. The solution also maintains compatibility with the test environment by detecting pytest runs and skipping the reconfiguration step when tests are executing.


  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.17.61 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request correctly fixes the logging configuration by ensuring uvicorn respects the custom logging setup. I've identified one concern about losing configuration flexibility in the Docker CMD, which should be addressed.

PR Bot Information

Version: 1.17.61 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Correlation ID: 2f9d7e30-10bd-11f1-9c8b-031709ae8b03
  • LLM: anthropic--claude-4.5-sonnet
  • Event Trigger: pull_request.opened

Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The pull request improves logging configuration by switching from fastapi run to direct Python execution with uvicorn.run(), adding environment variable support for host/port configuration. However, one bug was identified: the PORT environment variable parsing lacks error handling and will crash the application if set to a non-numeric value. This should be addressed before merging.

PR Bot Information

Version: 1.17.61 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • LLM: anthropic--claude-4.5-sonnet
  • Event Trigger: issue_comment.created
  • Correlation ID: 1b3b2e50-10be-11f1-8cc0-496c849df459

@hyperspace-insights hyperspace-insights bot deleted a comment from friedrichwilken Feb 23, 2026
@friedrichwilken friedrichwilken force-pushed the fix_logging_2026Feb23 branch 2 times, most recently from b477c06 to 05cbeb6 Compare February 24, 2026 08:55
@friedrichwilken friedrichwilken marked this pull request as ready for review February 24, 2026 09:23
@friedrichwilken friedrichwilken requested a review from a team as a code owner February 24, 2026 09:23
Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The pull request introduces a lifespan event handler to properly manage logging configuration when uvicorn starts. I identified one substantive bug: the AsyncGenerator type annotation is incomplete and missing the required send type parameter. This should be corrected to ensure proper type checking.

PR Bot Information

Version: 1.17.61 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Event Trigger: issue_comment.created
  • LLM: anthropic--claude-4.5-sonnet
  • Correlation ID: 71308b30-1162-11f1-8f3b-5e7cd99e3f55

@hyperspace-insights hyperspace-insights bot deleted a comment from friedrichwilken Feb 24, 2026
@friedrichwilken friedrichwilken added evaluation requested A PR with this label will trigger the validation workflow. run-integration-test labels Feb 24, 2026
@friedrichwilken friedrichwilken enabled auto-merge (squash) February 24, 2026 10:37
@friedrichwilken friedrichwilken self-assigned this Feb 24, 2026
@friedrichwilken friedrichwilken merged commit 7efae54 into kyma-project:main Feb 24, 2026
12 of 13 checks passed
@friedrichwilken friedrichwilken deleted the fix_logging_2026Feb23 branch February 24, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

evaluation requested A PR with this label will trigger the validation workflow. run-integration-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants