Skip to content
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

Migrate to python logging module with env var control. #1237

Merged
merged 3 commits into from
Mar 24, 2024

Conversation

lainedfles
Copy link
Contributor

Pull Request Checklist

  • Description: Briefly describe the changes 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.
  • Documentation: Have you updated relevant documentation?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?

Description

Introduce Python logging and migrate all print() statements to it. To mirror current functionality, logging doesn't use a file, only sys.stdout. A global var GLOBAL_LOG_LEVEL and any of following like OLLAMA_LOG_LEVEL=DEBUG can be set: log_sources = ["AUDIO", "CONFIG", "DB", "IMAGES", "LITELLM", "MAIN", "MODELS", "OLLAMA", "OPENAI", "RAG"]. Note that this is additionally beneficial as it affects any 3rd party imports that use the Python logging module including LITELLM.


Changelog Entry

First commit

Added

  • Introduce Python import logging functionality.

Fixed

  • Sensitive log items like the POST data and password hash now require DEBUG logging. Default is INFO.

Changed

  • Everywhere using print()

Removed

  • Replaced print() statements with log. statements.

@tjbck
Copy link
Contributor

tjbck commented Mar 21, 2024

Let's take this PR up a notch and include more logging statements where it's needed, contributions welcome!

@lainedfles
Copy link
Contributor Author

Can you clarify "where it's needed"? Did I miss some print statements? How else can I help? Thanks!

@tjbck
Copy link
Contributor

tjbck commented Mar 23, 2024

In my own testing I have been able to use the regular chat functionality with text input just fine, but I hit an issue with the document upload / RAG functionality: on attempting to upload a document I experience a 500 status code from the server but am not clear how I would be able to debug this further short of starting to add debug log statements, track trace output in myself. Am I missing a debug facility I should just turn on?

One comment from: #724

They're really optional and nice-to-haves, so we could merge this PR first and then start adding more logging statements.

@tjbck
Copy link
Contributor

tjbck commented Mar 24, 2024

Merging this for now, let's continue our discussion here: #1282 Thanks!

@tjbck tjbck changed the base branch from main to dev March 24, 2024 23:02
@tjbck tjbck merged commit ffa1682 into open-webui:dev Mar 24, 2024
2 checks passed
@lainedfles lainedfles deleted the debug_print branch April 6, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants