Skip to content

Commit

Permalink
Move debug logging logic to config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jessie-ross committed Jun 21, 2024
1 parent 527aa05 commit 0bc54dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,15 +893,15 @@ class D3TimeFormat(TypedDict, total=False):
# Console Log Settings

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
# ---------------------------------------------------
# LOG_LEVEL = DEBUG, INFO, WARNING, ERROR, CRITICAL

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")
ROLLOVER = "midnight"
INTERVAL = 1
Expand Down Expand Up @@ -1180,7 +1180,7 @@ def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC( # pylint: disable=invalid-name
# Whether to bump the logging level to ERROR on the flask_appbuilder package
# Set to False if/when debugging FAB related issues like
# permission management
SILENCE_FAB = True
SILENCE_FAB = not DEBUG

FAB_ADD_SECURITY_VIEWS = True
FAB_ADD_SECURITY_PERMISSION_VIEW = False
Expand Down
4 changes: 1 addition & 3 deletions superset/utils/logging_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def configure_logging(

# basicConfig() will set up a default StreamHandler on stderr
logging.basicConfig(format=app_config["LOG_FORMAT"])
logging.getLogger().setLevel(
logging.DEBUG if debug_mode else app_config["LOG_LEVEL"]
)
logging.getLogger().setLevel(app_config["LOG_LEVEL"])

if app_config["ENABLE_TIME_ROTATE"]:
logging.getLogger().setLevel(app_config["TIME_ROTATE_LOG_LEVEL"])
Expand Down

0 comments on commit 0bc54dc

Please sign in to comment.