Closed Moocar closed 9 years ago
as you have stated in the original request (https://github.com/Moocar/logback-gelf/issues/55), simple colon parsing might not be the best solution. So, I tend to like the new key/value proposal, yet in practice,indeed, the need to mention the class me.moocar.logbackgelf.Field for each static field makes it rather annoying...
An alternative syntax would be more user friendly when multiple static fields are to be defined, something like:
<staticField class="me.moocar.logbackgelf.Field">
<property_key1>property_value1</property_key1>
<property_key2>property_value2</property_key2>
</staticField>
It looks like valid logback syntax to me, not sure of it though, and not sure if feasible to implement. Would this be an option ?
Nope, I guess you can forget about my previous comment, presumably it's not valid syntax (those child nodes need to correspond to members of class of the enclosing node, I guess).
Might this be helpfull ? http://logback.qos.ch/manual/onJoran.html#CollectionOfProperties
Hey @roomsg, sorry for the late response here. The Collection of Properties refers to the ability to add many of a type of property instead of a single one. E.g, say foo is of type String, then you set a single instance of it with setFoo(...)
, but if you define it as a collection of Strings, you then add instances of it with addFoo(...)
.
It's been 2 months and I haven't thought of any better solutions here, so I'm just going to merge. I really wish logback was in Clojure. These kind of problems would just disappear :P
Addresses #55 by making static fields structured instead of relying on colon parsing. Thankfully the name
staticField
wasn't taken sostaticAdditionalField
is now deprecated. Read README changes for more info.Note, it would be really nice if the user didn't have to enter the class
me.moocar.logbackgelf.Field
manually each time, but after having perused through the logback documentation, I'm not aware of how to do this.