diff --git a/backend/resources/error-report.tmpl b/backend/resources/error-report.tmpl index 32f796d6d..a439cea4e 100644 --- a/backend/resources/error-report.tmpl +++ b/backend/resources/error-report.tmpl @@ -58,9 +58,15 @@
-
ERID:
+
ERID:
{{id}}
+ {% if profile-id %} +
+
PFID:
+
{{profile-id}}
+
+ {% endif %}
VERS:
{{version}}
diff --git a/backend/src/app/error_reporter.clj b/backend/src/app/error_reporter.clj index 7b9ddead8..2d9ec0cbc 100644 --- a/backend/src/app/error_reporter.clj +++ b/backend/src/app/error_reporter.clj @@ -20,7 +20,6 @@ [app.util.json :as json] [app.util.http :as http] [app.util.template :as tmpl] - [clojure.pprint :refer [pprint]] [clojure.core.async :as a] [clojure.spec.alpha :as s] [clojure.tools.logging :as log] @@ -74,7 +73,8 @@ [event] (let [^LogEvent levent (deref event) ^ReadOnlyStringMap rosm (.getContextData levent)] - (into {:message (str event)} + (into {:message (str event) + :id (uuid/next)} ; set default uuid for cases when it not comes. (comp (map (fn [[key val]] (cond diff --git a/backend/src/app/http/errors.clj b/backend/src/app/http/errors.clj index 7c16e965e..b1a346a04 100644 --- a/backend/src/app/http/errors.clj +++ b/backend/src/app/http/errors.clj @@ -26,7 +26,9 @@ (ThreadContext/put (name key) (cond - (coll? val) (with-out-str (pprint val)) + (coll? val) + (binding [clojure.pprint/*print-right-margin* 120] + (with-out-str (pprint val))) (instance? clojure.lang.Named val) (name val) :else (str val)))) data)) diff --git a/backend/src/app/http/session.clj b/backend/src/app/http/session.clj index c83ddd4ea..84feb10c0 100644 --- a/backend/src/app/http/session.clj +++ b/backend/src/app/http/session.clj @@ -12,6 +12,7 @@ [clojure.spec.alpha :as s] [integrant.core :as ig] [app.db :as db] + [app.http.errors :refer [update-thread-context!]] [buddy.core.codecs :as bc] [buddy.core.nonce :as bn])) @@ -55,7 +56,9 @@ [cfg handler] (fn [request] (if-let [profile-id (retrieve-from-request cfg request)] - (handler (assoc request :profile-id profile-id)) + (do + (update-thread-context! {:profile-id profile-id}) + (handler (assoc request :profile-id profile-id))) (handler request)))) (defmethod ig/pre-init-spec ::session [_]