-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numeric fields are not of numeric type in resulting JSON #496
Comments
hi @kluen, thank you for report current implementation of json def appendNumeric[A](numeric: A): Unit = appendText(numeric.toString) not sure what was reason for that, but i will discuss it, and let you know (i am not author of this LogAppender) in general it is about how specific but also, I think, if there is possibility to have it like number, it should be number, not string ... |
hi @davidlar, as you are author of json Thank you very much. |
Hi! As I remember appendNumeric wasn't used by any existing log format, so I didn't bother. It should be easy to fix though. |
hi @davidlar, i think, in general most of log appenders transforming log inputs to string, so maybe that is reason why it was like that but if there is possibility to use specific data types, in my opinion, we should use it, so i think we should have it also in json like number not like string |
@davidlar In my particular case, I need some fields to be numbers so that the log format adheres to a common schema defined by our central log aggregation (we are trying to mimic the output of the widely used logback-logstash-encoder). I believe log aggregation with a schema like this might be a fairly common use case. |
I think we can fix it for simple cases like
but if you concat formats like this
it will result in a json string, of course. Does that feel ok to you? |
Hi @davidlar, i think your proposal is good. Are you willing to make these changes? Thanks. |
Sure! |
I'm trying to produce numeric fields in the JSON output when using
consoleJson
.Here is an example where I am trying to print the line number of the trace:
which results in
Note that the
"10"
is actually a string, not a number.Looking at the code, I was wondering how exactly
LogAppender.appendNumeric
is intended to be used anyway. It seems odd that it excepts any type:def appendNumeric[A](numeric: A): Unit
.The text was updated successfully, but these errors were encountered: