aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-31 15:31:57 -0500
committerAlexander_Kabui2024-08-28 15:02:46 +0300
commit31355c890dfc81b7c77792221a3c6592154fab9f (patch)
treefa90860de02ed6c445c7a3d57748a489766b90ae /gn2
parent2ff7cf9ff8640328c5849c5ff07bd0113a303856 (diff)
downloadgenenetwork2-31355c890dfc81b7c77792221a3c6592154fab9f.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__.py2
-rw-r--r--gn2/wqflask/app_errors.py2
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("/")