forked from phoenix/litellm-mirror
(docs) control proxy debug using env vars
This commit is contained in:
parent
5d7646b30a
commit
fa74831d79
2 changed files with 49 additions and 7 deletions
|
@ -611,16 +611,31 @@ print(result)
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
## Debugging Proxy
|
## Debugging Proxy
|
||||||
Run the proxy with `--debug` to easily view debug logs
|
|
||||||
|
Events that occur during normal operation
|
||||||
```shell
|
```shell
|
||||||
litellm --model gpt-3.5-turbo --debug
|
litellm --model gpt-3.5-turbo --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
When making requests you should see the POST request sent by LiteLLM to the LLM on the Terminal output
|
Detailed information
|
||||||
```shell
|
```shell
|
||||||
POST Request Sent from LiteLLM:
|
litellm --model gpt-3.5-turbo --detailed_debug
|
||||||
curl -X POST \
|
|
||||||
https://api.openai.com/v1/chat/completions \
|
|
||||||
-H 'content-type: application/json' -H 'Authorization: Bearer sk-qnWGUIW9****************************************' \
|
|
||||||
-d '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "this is a test request, write a short poem"}]}'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Set Debug Level using env variables
|
||||||
|
|
||||||
|
Events that occur during normal operation
|
||||||
|
```shell
|
||||||
|
export LITELLM_LOG=INFO
|
||||||
|
```
|
||||||
|
|
||||||
|
Detailed information
|
||||||
|
```shell
|
||||||
|
export LITELLM_LOG=DEBUG
|
||||||
|
```
|
||||||
|
|
||||||
|
No Logs
|
||||||
|
```shell
|
||||||
|
export LITELLM_LOG=None
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -976,6 +976,33 @@ async def initialize(
|
||||||
verbose_router_logger.setLevel(level=logging.DEBUG) # set router logs to info
|
verbose_router_logger.setLevel(level=logging.DEBUG) # set router logs to info
|
||||||
verbose_proxy_logger.setLevel(level=logging.DEBUG) # set proxy logs to debug
|
verbose_proxy_logger.setLevel(level=logging.DEBUG) # set proxy logs to debug
|
||||||
litellm.set_verbose = True
|
litellm.set_verbose = True
|
||||||
|
elif debug == False and detailed_debug == False:
|
||||||
|
# users can control proxy debugging using env variable = 'LITELLM_LOG'
|
||||||
|
litellm_log_setting = os.environ.get("LITELLM_LOG", "")
|
||||||
|
if litellm_log_setting != None:
|
||||||
|
if litellm_log_setting.upper() == "INFO":
|
||||||
|
from litellm._logging import verbose_router_logger, verbose_proxy_logger
|
||||||
|
import logging
|
||||||
|
|
||||||
|
# this must ALWAYS remain logging.INFO, DO NOT MODIFY THIS
|
||||||
|
|
||||||
|
verbose_router_logger.setLevel(
|
||||||
|
level=logging.INFO
|
||||||
|
) # set router logs to info
|
||||||
|
verbose_proxy_logger.setLevel(
|
||||||
|
level=logging.INFO
|
||||||
|
) # set proxy logs to info
|
||||||
|
elif litellm_log_setting.upper() == "DEBUG":
|
||||||
|
from litellm._logging import verbose_router_logger, verbose_proxy_logger
|
||||||
|
import logging
|
||||||
|
|
||||||
|
verbose_router_logger.setLevel(
|
||||||
|
level=logging.DEBUG
|
||||||
|
) # set router logs to info
|
||||||
|
verbose_proxy_logger.setLevel(
|
||||||
|
level=logging.DEBUG
|
||||||
|
) # set proxy logs to debug
|
||||||
|
litellm.set_verbose = True
|
||||||
|
|
||||||
dynamic_config = {"general": {}, user_model: {}}
|
dynamic_config = {"general": {}, user_model: {}}
|
||||||
if config:
|
if config:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue