SaTae66 commented on issue #21646:
URL: https://github.com/apache/superset/issues/21646#issuecomment-1532535695
From what I managed to find out, superset logs itself but somehow the
messages are propagated up to gunicorn, which itself logs everything again. My
knowledge about python is very limited, so I could not locate the root of the
problem, however I found a workaround.
I disabled all logging for superset by adding the following to the conifg.py:
```
class NoLoggingConfigurator( # pylint: disable=too-few-public-methods
LoggingConfigurator
):
def configure_logging(
self, app_config, debug_mode
) -> None:
logger.info("logging was configured successfully")
# disable logging for superset; logs are handled by gunicorn
LOGGING_CONFIGURATOR = NoLoggingConfigurator()
```
Furthermore, I added those 2 files to the root dir of superset:
1. gunicorn_logging.conf from
[stackoverflow](https://stackoverflow.com/questions/34753214/json-formatted-logging-with-flask-and-gunicorn)
2. jsonlogging.py from
[github](https://github.com/sebest/json-logging-py/blob/master/jsonlogging.py)
Now add `--log-config gunicorn_logging.conf` to the gunicorn command when
starting superset and there will be only the json loggs from gunicorn. I am
also setting the env variable `PYTHONWARNINGS=ignore` to prevent any (non-json)
warnings from showing up.
------------------------------------------------------------------------------------------------------------
I still believe that logging should work properly without such a workaround,
especially if it explicitly recommanded in the docs to use gunicorn.
--
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]