diff options
author | Frederick Muriuki Muriithi | 2024-07-31 15:31:57 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-07-31 15:31:57 -0500 |
commit | 6cb592ac79f87c5357c3da1fd8da05b355d9b6f9 (patch) | |
tree | 95f3531d97d30f28bfdc0842c9681c281dada892 /gn2 | |
parent | b9a0a5d4b64c65c9472b253db7a28cb91328401f (diff) | |
download | genenetwork2-6cb592ac79f87c5357c3da1fd8da05b355d9b6f9.tar.gz |
Improve logging
Add more logging information to help with tracking and fixing bugs.
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/wqflask/__init__.py | 2 | ||||
-rw-r--r-- | gn2/wqflask/app_errors.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/gn2/wqflask/__init__.py b/gn2/wqflask/__init__.py index f85454ba..3744db50 100644 --- a/gn2/wqflask/__init__.py +++ b/gn2/wqflask/__init__.py @@ -70,7 +70,7 @@ def parse_ssl_key(app: Flask, keyconfig: str): def dev_loggers(appl: Flask) -> None: """Default development logging.""" formatter = logging.Formatter( - fmt="[%(asctime)s] %(levelname)s in %(module)s: %(message)s") + fmt="[%(asctime)s] %(levelname)s [%(thread)d -- %(threadName)s] in %(module)s: %(message)s") stderr_handler = logging.StreamHandler(stream=sys.stderr) stderr_handler.setFormatter(formatter) appl.logger.addHandler(stderr_handler) diff --git a/gn2/wqflask/app_errors.py b/gn2/wqflask/app_errors.py index 5b85bd53..7c07fde6 100644 --- a/gn2/wqflask/app_errors.py +++ b/gn2/wqflask/app_errors.py @@ -51,6 +51,7 @@ def handle_invalid_token_error(exc: InvalidTokenError): flash("An invalid session token was detected. " "You have been logged out of the system.", "alert-danger") + current_app.logger.error("Invalit token detected. %s", request.url, exc_info=True) session.clear_session_info() return redirect("/") @@ -71,6 +72,7 @@ def handle_oauth_error(exc: OAuthError): flash((f"{type(exc).__name__}: {__build_message__(exc)} " "Please log in again to continue."), "alert-danger") + current_app.logger.error("Invalit token detected. %s", request.url, exc_info=True) session.clear_session_info() return redirect("/") |