-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Logging java.lang.Exception and (java.lang.Throwable or java.lang.AssertionError) causes type problems (ironic? :)) due to the way type-mangle is implemented.
The relevant part of type-mangle (https://github.com/BrunoBonacci/mulog/blob/master/mulog-elasticsearch/src/com/brunobonacci/mulog/publishers/util.clj#L31):
(defn type-mangle
[[k v :as e]]
(cond
,,,
(instance? Exception v) [(str k ".x") (ut/exception-stacktrace v)]
:else e
))This causes:
- Exception is mangled as equivalent of
{"exception": {"x": "exception stack trace"}} - Throwable is mangled as equivalent of
{"exception": "exception stack trace"}
This doesn't work in ElasticSearch. "exception" must either be an object or a string.
ES HTTP error:
...
:status 400
:error {:type "mapper_parsing_exception"
:reason "object mapping for [exception] tried to parse field [exception] as object, but found a concrete value"}
...
Suggestion
Change cond
(instance? Exception v) [(str k ".x") (ut/exception-stacktrace v)]
into
(instance? Throwable v) [(str k ".x") (ut/exception-stacktrace v)]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working