about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-07-31 15:31:57 -0500
committerFrederick Muriuki Muriithi2024-07-31 15:31:57 -0500
commit6cb592ac79f87c5357c3da1fd8da05b355d9b6f9 (patch)
tree95f3531d97d30f28bfdc0842c9681c281dada892
parentb9a0a5d4b64c65c9472b253db7a28cb91328401f (diff)
downloadgenenetwork2-6cb592ac79f87c5357c3da1fd8da05b355d9b6f9.tar.gz
Improve logging
Add more logging information to help with tracking and fixing bugs.
-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("/")