-
Notifications
You must be signed in to change notification settings - Fork 104
Switch off additional fields while using Logback #144
Comments
Care to elaborate why you want to disable all auxiliary fields? That's typically a task for logstash filters. |
Got it, thank you! Generally, to keep the log output more uniform with the other applications without additional adjustments on Logstash side. They are also described in the documentation as additional fields, so my expectation was that by default I only send default fields. Currently, my team is using log4j2 for apps, and recently another app was developed, which is using logback. So the idea was to achieve the same message layout without adding new fields and touching filters. |
This library wasn't really developed for this use but rather to submit as much data as possible. I'd keep this ticket open to see how common this use case is and wait for votes. |
Hello, First, I would like to thank you for creating this useful library. Coming to this issue - I think few attributes should be optional & turned off by default. These are listed below and they have common characteristic - performance impact while logging using log4j. Essentially, all these attributes that are related to caller location logging. SourceClassName There is performance cost while logging this info since log4j creates new Throwable() for each log statement & parses it. I have blogged more about this issue here -> https://medium.com/@manasvi/do-not-enable-caller-location-logging-with-log4j-3c90f9aaabdb Either,
Let me know your thoughts. Thanks |
Also, my suggestion is to prefer option # 1 (from previous comment) i.e. turn off caller location attributes by default. Just for comparison - log4j2, which support gelf layout also does not log caller location attributes by default (i don't think it provides any option to enable it also). |
Thanks a lot. Thinking in the way of including/excluding caller location details is a reasonable approach that does not touch filtering of fields. Adding this configuration switch is an easy exercise as we need to add configuration flags to the appender/formatters we're providing. Location details would stay included by default to not break the current behavior. Users that want to disable location details could set e.g. |
Ok that works too. Thanks! |
I am going to take stab at this today. I haven't looked at code yet, but, I am hoping its a small change. |
Ok, so, I have fix ready & tested with Log4J. I will raise a pull request for your review by this weekend or early next week. |
logstash-gelf now allows disabling source location fields to reduce the amount of fields that are sent with the GELF messages and to reduce cost of log event submission when source details are not needed.
That's in place now. |
Nice. 👍 You beat me to it. How long does it for 1.12.0 version (with these changes) to reflect in maven repository? |
Hi, I am seeing this warning when i use "includeLocation" attribute as param. log4j:WARN No such property [includeLocation] in biz.paluch.logging.gelf.log4j.GelfLayout. It seems that setter is missing in GelfLayout.java. Thanks |
@manasvigupta Can you file a new bug report? |
Hi!
Could you please advise how I can switch off all the additional fields while using logback, like these:
Currently, when
default-logstash-fields.properties
doesn't exist I observe all the additional fields. So far I would like to keep only default fields (as in the documentation) like:I have found a workaround, when I provide
default-logstash-fields.properties
with the content like:""=Time
, then I see only default values in my logging solution. Still, it looks ugly and I think there should be a better way.Kind regards,
Sergei
The text was updated successfully, but these errors were encountered: