From 99982a41ab34169214b5de3508e9ddcd4c2d5bc6 Mon Sep 17 00:00:00 2001 From: Self Denial Date: Sat, 30 Mar 2024 00:33:14 -0600 Subject: [PATCH 1/2] Add basic logging --- docs/getting-started/logging.md | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 docs/getting-started/logging.md diff --git a/docs/getting-started/logging.md b/docs/getting-started/logging.md new file mode 100644 index 00000000..a222e78e --- /dev/null +++ b/docs/getting-started/logging.md @@ -0,0 +1,58 @@ +# Logging + +## Browser Client Logging ## + +Client logging generally occurs via [JavaScript](https://developer.mozilla.org/en-US/docs/Web/API/console/log_static) `console.log()` and can be accessed using the built-in browser-specific developer tools: +* Blink + * [Chrome/Chromium](https://developer.chrome.com/docs/devtools/) + * [Edge](https://learn.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/overview) +* Gecko + * [Firefox](https://firefox-source-docs.mozilla.org/devtools-user/) +* WebKit + * [Safari](https://developer.apple.com/safari/tools/) + +## Application Server/Backend Logging ## + +Logging is an ongoing work-in-progress but some level of control is available using environment variables. [Python Logging](https://docs.python.org/3/howto/logging.html) `log()` and `print()` statements send information to the console. The default level is `INFO`. + +### Logging Levels ### + +The following [logging levels](https://docs.python.org/3/howto/logging.html#logging-levels) values are supported: + +| Level | Numeric value | +| ---------- | ------------- | +| `CRITICAL` | 50 | +| `ERROR` | 40 | +| `WARNING` | 30 | +| `INFO` | 20 | +| `DEBUG` | 10 | +| `NOTSET` | 0 | + +### Global ### + +The default global log level of `INFO` can be overridden with the `GLOBAL_LOG_LEVEL` environment variable. When set, this executes a [basicConfig](https://docs.python.org/3/library/logging.html#logging.basicConfig) statement with the `force` argument set to *True* within `config.py`. This results in reconfiguration of all attached loggers: +> _If this keyword argument is specified as true, any existing handlers attached to the root logger are removed and closed, before carrying out the configuration as specified by the other arguments._ + +In addition to all Open-WebUI `log()` statements, this also affects any imported Python modules that use the Python Logging module `basicConfig` mechanism including [urllib](https://docs.python.org/3/library/urllib.html). + +For example, set as a Docker parameter: +``` +--env GLOBAL_LOG_LEVEL="INFO" +``` + +### App/Backend ### + +Some level of granularity is possible using any of the following combination of variables. Note that `basicConfig` `force` isn't presently used so these statements may only affect Open-WebUI logging and not 3rd party modules. + +| Environment Variable | App/Backend | +| -------------------- | ----------------------------------------------------------------- | +| `AUDIO_LOG_LEVEL` | Audio transcription, etc. | +| `CONFIG_LOG_LEVEL` | Configuration handling | +| `DB_LOG_LEVEL` | Internal Peewee Database | +| `IMAGES_LOG_LEVEL` | AUTOMATIC1111 stable diffusion image generation | +| `LITELLM_LOG_LEVEL` | LiteLLM proxy | +| `MAIN_LOG_LEVEL` | Main (root) execution | +| `MODELS_LOG_LEVEL` | LLM model interaction, authentication, etc. | +| `OLLAMA_LOG_LEVEL` | Ollama backend interaction | +| `OPENAI_LOG_LEVEL` | OpenAI interaction | +| `RAG_LOG_LEVEL` | Retrieval-Augmented Generation using Chroma/Sentence-Transformers | From 5efe3d548d5b6fc578ab11fb1fcaeb0dbf2692ec Mon Sep 17 00:00:00 2001 From: Self Denial Date: Sat, 30 Mar 2024 00:44:50 -0600 Subject: [PATCH 2/2] Small update to global example --- docs/getting-started/logging.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/logging.md b/docs/getting-started/logging.md index a222e78e..6ade5200 100644 --- a/docs/getting-started/logging.md +++ b/docs/getting-started/logging.md @@ -35,9 +35,9 @@ The default global log level of `INFO` can be overridden with the `GLOBAL_LOG_LE In addition to all Open-WebUI `log()` statements, this also affects any imported Python modules that use the Python Logging module `basicConfig` mechanism including [urllib](https://docs.python.org/3/library/urllib.html). -For example, set as a Docker parameter: +For example, set `DEBUG` logging level as a Docker parameter: ``` ---env GLOBAL_LOG_LEVEL="INFO" +--env GLOBAL_LOG_LEVEL="DEBUG" ``` ### App/Backend ###