fix: default logging (#27777)

This commit is contained in:
Jessie R 2024-06-26 03:25:21 +07:00 committed by GitHub
parent dffad48504
commit d74d3a87bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 13 deletions

View File

@ -47,6 +47,8 @@ assists people when migrating to a new version.
set `SLACK_API_TOKEN` to fetch and serve Slack avatar links set `SLACK_API_TOKEN` to fetch and serve Slack avatar links
- [28134](https://github.com/apache/superset/pull/28134/) The default logging level was changed - [28134](https://github.com/apache/superset/pull/28134/) The default logging level was changed
from DEBUG to INFO - which is the normal/sane default logging level for most software. from DEBUG to INFO - which is the normal/sane default logging level for most software.
- [27777](https://github.com/apache/superset/pull/27777) Moves debug logging logic to config.py.
See `LOG_LEVEL` in `superset/config.py` for the recommended default.
- [28205](https://github.com/apache/superset/pull/28205) The permission `all_database_access` now - [28205](https://github.com/apache/superset/pull/28205) The permission `all_database_access` now
more clearly provides access to all databases, as specified in its name. Before it only allowed more clearly provides access to all databases, as specified in its name. Before it only allowed
listing all databases in CRUD-view and dropdown and didn't provide access to data as it listing all databases in CRUD-view and dropdown and didn't provide access to data as it

View File

@ -895,7 +895,7 @@ LOGGING_CONFIGURATOR = DefaultLoggingConfigurator()
# Console Log Settings # Console Log Settings
LOG_FORMAT = "%(asctime)s:%(levelname)s:%(name)s:%(message)s" LOG_FORMAT = "%(asctime)s:%(levelname)s:%(name)s:%(message)s"
LOG_LEVEL = logging.INFO LOG_LEVEL = logging.DEBUG if DEBUG else logging.INFO
# --------------------------------------------------- # ---------------------------------------------------
# Enable Time Rotate Log Handler # Enable Time Rotate Log Handler
@ -903,7 +903,7 @@ LOG_LEVEL = logging.INFO
# LOG_LEVEL = DEBUG, INFO, WARNING, ERROR, CRITICAL # LOG_LEVEL = DEBUG, INFO, WARNING, ERROR, CRITICAL
ENABLE_TIME_ROTATE = False ENABLE_TIME_ROTATE = False
TIME_ROTATE_LOG_LEVEL = logging.INFO TIME_ROTATE_LOG_LEVEL = logging.DEBUG if DEBUG else logging.INFO
FILENAME = os.path.join(DATA_DIR, "superset.log") FILENAME = os.path.join(DATA_DIR, "superset.log")
ROLLOVER = "midnight" ROLLOVER = "midnight"
INTERVAL = 1 INTERVAL = 1

View File

@ -41,17 +41,7 @@ class DefaultLoggingConfigurator( # pylint: disable=too-few-public-methods
if app_config["SILENCE_FAB"]: if app_config["SILENCE_FAB"]:
logging.getLogger("flask_appbuilder").setLevel(logging.ERROR) logging.getLogger("flask_appbuilder").setLevel(logging.ERROR)
# configure superset app logger # basicConfig() will set up a default StreamHandler on stderr
superset_logger = logging.getLogger("superset")
if debug_mode:
superset_logger.setLevel(logging.DEBUG)
else:
# In production mode, add log handler to sys.stderr.
superset_logger.addHandler(logging.StreamHandler())
superset_logger.setLevel(logging.INFO)
logging.getLogger("pyhive.presto").setLevel(logging.INFO)
logging.basicConfig(format=app_config["LOG_FORMAT"]) logging.basicConfig(format=app_config["LOG_FORMAT"])
logging.getLogger().setLevel(app_config["LOG_LEVEL"]) logging.getLogger().setLevel(app_config["LOG_LEVEL"])