dosubot[bot] commented on issue #37928:
URL: https://github.com/apache/superset/issues/37928#issuecomment-3890817916

   <!-- Answer -->
   This is a known issue in Superset 6.0.0: environment variables like 
`SUPERSET_LOG_LEVEL` are not automatically respected because the codebase never 
reads them for logging configuration. The log level is set based on the `DEBUG` 
flag (from `FLASK_DEBUG`), not `SUPERSET_LOG_LEVEL`—so setting 
`SUPERSET_LOG_LEVEL` in your environment has no effect unless you explicitly 
handle it in your config file. This applies to both Docker and non-Docker 
setups 
[source](https://github.com/apache/superset/issues/37842#issuecomment-3890688837).
   
   If you want to control the logging level via environment variables, you need 
to modify your `superset_config.py` (or `superset_config_docker.py`) to read 
from the environment and set the `LOG_LEVEL` config variable. For example:
   
   ```python
   import os
   
   def get_env_variable(name, default):
       return os.environ.get(name, default)
   
   LOG_LEVEL = get_env_variable("SUPERSET_LOG_LEVEL", "INFO")
   ```
   
   This will allow you to set `SUPERSET_LOG_LEVEL` in your environment and have 
it actually affect Superset's logging 
[source](https://github.com/apache/superset/discussions/37264#discussioncomment-15545328).
   
   For Docker Compose, be aware that variables set in the `environment` section 
of your YAML override those from `.env` or `.env-local` files. If your 
`.env-local` changes are being ignored, either remove the explicit variable 
from the Compose YAML or set it in your host shell before running Compose 
[source](https://github.com/apache/superset/issues/35843).
   
   If you need to suppress verbose logs from third-party libraries (like 
`watchdog`), you can set their log levels directly in your config file:
   
   ```python
   import logging
   logging.getLogger("watchdog").setLevel(logging.ERROR)
   ```
   
[source](https://github.com/apache/superset/discussions/36152#discussioncomment-14996526)
   
   Let me know if you need more details on config overrides or troubleshooting 
secret key rotation.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/37a61bde-160a-4eaa-b790-145dfbf70ce5?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20issue%20in%20Superset%206.0.0%3A%20environment%20variables%20like%20%60SUPERSET_LOG_LEVEL%60%20are%20not%20automatically%20respected%20because%20the%20codebase%20never%20reads%20them%20for%20logging%20configuration.%20The%20log%20level%20is%20set%20based%20on%20the%20%60DEBUG%60%20flag%20%28from%20%60FLASK_DEBUG%60%29%2C%20not%20%60SUPERSET_LOG_LEVEL%60%E2%80%94so%20setting%20%60SUPERSET_LOG_LEVEL%60%20in%20your%20environment%20has%20no%20effect%20unless%20you%20explicitly%20handle%20it%20in%20your%20config%20file.%20This%20applies%20to%20both%20Docker%20and%20non-Docker%20setups%20%5Bsource%5D%28https%3A//github.com/apache/superset/issues/37842%23issuecomment-3890688837%29.%0A%0AIf%20you%20want%20to%20control%20the%20loggin
 
g%20level%20via%20environment%20variables%2C%20you%20need%20to%20modify%20your%20%60superset_config.py%60%20%28or%20%60superset_config_docker.py%60%29%20to%20read%20from%20the%20environment%20and%20set%20the%20%60LOG_LEVEL%60%20config%20variable.%20For%20example%3A%0A%0A%60%60%60python%0Aimport%20os%0A%0Adef%20get_env_variable%28name%2C%20default%29%3A%0A%20%20%20%20return%20os.environ.get%28name%2C%20default%29%0A%0ALOG_LEVEL%20%3D%20get_env_variable%28%22SUPERSET_LOG_LEVEL%22%2C%20%22INFO%22%29%0A%60%60%60%0A%0AThis%20will%20allow%20you%20to%20set%20%60SUPERSET_LOG_LEVEL%60%20in%20your%20environment%20and%20have%20it%20actually%20affect%20Superset%27s%20logging%20%5Bsource%5D%28https%3A//github.com/apache/superset/discussions/37264%23discussioncomment-15545328%29.%0A%0AFor%20Docker%20Compose%2C%20be%20aware%20that%20variables%20set%20in%20the%20%60environment%60%20section%20of%20your%20YAML%20override%20those%20from%20%60.env%60%20or%20%60.env-local%60%20files.%20If%20your%20%60.e
 
nv-local%60%20changes%20are%20being%20ignored%2C%20either%20remove%20the%20explicit%20variable%20from%20the%20Compose%20YAML%20or%20set%20it%20in%20your%20host%20shell%20before%20running%20Compose%20%5Bsource%5D%28https%3A//github.com/apache/superset/issues/35843%29.%0A%0AIf%20you%20need%20to%20suppress%20verbose%20logs%20from%20third-party%20libraries%20%28like%20%60watchdog%60%29%2C%20you%20can%20set%20their%20log%20levels%20directly%20in%20your%20config%20file%3A%0A%0A%60%60%60python%0Aimport%20logging%0Alogging.getLogger%28%22watchdog%22%29.setLevel%28logging.ERROR%29%0A%60%60%60%0A%5Bsource%5D%28https%3A//github.com/apache/superset/discussions/36152%23discussioncomment-14996526%29%0A%0ALet%20me%20know%20if%20you%20need%20more%20details%20on%20config%20overrides%20or%20troubleshooting%20secret%20key%20rotation.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on X](https://img.shi
 
elds.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37928)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to