tigerinus opened a new issue, #30135:
URL: https://github.com/apache/superset/issues/30135

   ### Bug description
   
   
https://github.com/apache/superset/blob/4.0.2/superset/utils/logging_configurator.py#L50
   
   This line overrides any `logging.basicConfig(...)` and reset the stream to 
`stderr`.
   
   This is causing logging service in cloud platforms such as Google Cloud, 
specifically GKE, to falsely identify its output as errors, causing confusions 
to operation team.
   
   ### How to reproduce the bug
   
   Just run superset and look for anything written to stderr - there are 
messages that are not actually errors.
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   4.0.2
   
   ### Python version
   
   3.11
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   I need to apply following workaround to prevent it sending logs to stderr - 
but for people who don't know, each of them will be confused before finding 
this issue report:
   
   ```python
   import logging
   import sys
   
   from flask import Config
   from superset.utils.logging_configurator import DefaultLoggingConfigurator
   
   SECRET_KEY = "thisismysecretkey"
   
   
   class StdoutLoggingConfigurator(DefaultLoggingConfigurator):
       def configure_logging(self, app_config: Config, debug_mode: bool) -> 
None:
           super().configure_logging(app_config, debug_mode)
           superset_logger = logging.getLogger("superset")
           for handler in superset_logger.handlers:
               superset_logger.removeHandler(handler)
   
   
   LOGGING_CONFIGURATOR = StdoutLoggingConfigurator()
   
   logging.basicConfig(
       stream=sys.stdout,
       format="whatever - %(asctime)s:%(levelname)s:%(name)s:%(message)s",
       force=True,
   )
   
   ```
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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