You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/04/23 18:43:46 UTC
(superset) branch master updated: chore: clean up console upon firing up the CLI (#28134)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 68c77d6e9f chore: clean up console upon firing up the CLI (#28134)
68c77d6e9f is described below
commit 68c77d6e9f199b95f6c1e6cad326a1d7156c0efe
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Tue Apr 23 11:43:39 2024 -0700
chore: clean up console upon firing up the CLI (#28134)
---
UPDATING.md | 2 ++
superset/cli/main.py | 3 ++-
superset/config.py | 15 ++++++++++-----
superset/utils/log.py | 2 +-
superset/utils/logging_configurator.py | 2 +-
5 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/UPDATING.md b/UPDATING.md
index 38c40bbdd0..c7e00b44e1 100644
--- a/UPDATING.md
+++ b/UPDATING.md
@@ -41,6 +41,8 @@ assists people when migrating to a new version.
- [27849](https://github.com/apache/superset/pull/27849/) More of an FYI, but we have a
new config `SLACK_ENABLE_AVATARS` (False by default) that works in conjunction with
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
+ from DEBUG to INFO - which is the normal/sane default logging level for most software.
## 4.0.0
diff --git a/superset/cli/main.py b/superset/cli/main.py
index d837d236d5..aa7e3068f8 100755
--- a/superset/cli/main.py
+++ b/superset/cli/main.py
@@ -37,7 +37,8 @@ logger = logging.getLogger(__name__)
)
@with_appcontext
def superset() -> None:
- """This is a management script for the Superset application."""
+ """\033[1;37mThe Apache Superset CLI\033[0m"""
+ # NOTE: codes above are ANSI color codes for bold white in CLI header ^^^
@app.shell_context_processor
def make_shell_context() -> dict[str, Any]:
diff --git a/superset/config.py b/superset/config.py
index 8e0db72b28..940a167bd0 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -20,6 +20,7 @@ All configuration in this file can be overridden by providing a superset_config
in your PYTHONPATH as there is a ``from superset_config import *``
at the end of this file.
"""
+
# mypy: ignore-errors
# pylint: disable=too-many-lines
from __future__ import annotations
@@ -37,6 +38,7 @@ from email.mime.multipart import MIMEMultipart
from importlib.resources import files
from typing import Any, Callable, Literal, TYPE_CHECKING, TypedDict
+import click
import pkg_resources
from celery.schedules import crontab
from flask import Blueprint
@@ -274,7 +276,7 @@ SCHEDULED_QUERIES: dict[str, Any] = {}
# feature is on by default to make Superset secure by default, but you should
# fine tune the limits to your needs. You can read more about the different
# parameters here: https://flask-limiter.readthedocs.io/en/stable/configuration.html
-RATELIMIT_ENABLED = True
+RATELIMIT_ENABLED = os.environ.get("SUPERSET_ENV") == "production"
RATELIMIT_APPLICATION = "50 per second"
AUTH_RATE_LIMITED = True
AUTH_RATE_LIMIT = "5 per second"
@@ -847,7 +849,7 @@ LOGGING_CONFIGURATOR = DefaultLoggingConfigurator()
# Console Log Settings
LOG_FORMAT = "%(asctime)s:%(levelname)s:%(name)s:%(message)s"
-LOG_LEVEL = "DEBUG"
+LOG_LEVEL = logging.INFO
# ---------------------------------------------------
# Enable Time Rotate Log Handler
@@ -855,7 +857,7 @@ LOG_LEVEL = "DEBUG"
# LOG_LEVEL = DEBUG, INFO, WARNING, ERROR, CRITICAL
ENABLE_TIME_ROTATE = False
-TIME_ROTATE_LOG_LEVEL = "DEBUG"
+TIME_ROTATE_LOG_LEVEL = logging.INFO
FILENAME = os.path.join(DATA_DIR, "superset.log")
ROLLOVER = "midnight"
INTERVAL = 1
@@ -1746,7 +1748,7 @@ if CONFIG_PATH_ENV_VAR in os.environ:
if key.isupper():
setattr(module, key, getattr(override_conf, key))
- print(f"Loaded your LOCAL configuration at [{cfg_path}]")
+ click.secho(f"Loaded your LOCAL configuration at [{cfg_path}]", fg="cyan")
except Exception:
logger.exception(
"Failed to import config for %s=%s", CONFIG_PATH_ENV_VAR, cfg_path
@@ -1758,7 +1760,10 @@ elif importlib.util.find_spec("superset_config") and not is_test():
import superset_config
from superset_config import * # noqa: F403, F401
- print(f"Loaded your LOCAL configuration at [{superset_config.__file__}]")
+ click.secho(
+ f"Loaded your LOCAL configuration at [{superset_config.__file__}]",
+ fg="cyan",
+ )
except Exception:
logger.exception("Found but failed to import local superset_config")
raise
diff --git a/superset/utils/log.py b/superset/utils/log.py
index 0958727f98..cb5343470d 100644
--- a/superset/utils/log.py
+++ b/superset/utils/log.py
@@ -321,7 +321,7 @@ def get_event_logger_from_cfg_value(cfg_value: Any) -> AbstractEventLogger:
"of superset.utils.log.AbstractEventLogger."
)
- logging.info("Configured event logger of type %s", type(result))
+ logging.debug("Configured event logger of type %s", type(result))
return cast(AbstractEventLogger, result)
diff --git a/superset/utils/logging_configurator.py b/superset/utils/logging_configurator.py
index 5753b3941c..ba4bf2117f 100644
--- a/superset/utils/logging_configurator.py
+++ b/superset/utils/logging_configurator.py
@@ -65,4 +65,4 @@ class DefaultLoggingConfigurator( # pylint: disable=too-few-public-methods
)
logging.getLogger().addHandler(handler)
- logger.info("logging was configured successfully")
+ logger.debug("logging was configured successfully")