You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Property must be validated eagerly by the corresponding setter method. An IllegalArgumentException should be thrown when the validation fails. A NullPointerException is currently thrown in most cases for not-null properties - an IllegalStateException should be used instead for consistency.
The exception message often reports the name of the property which is not required. When Joran fails to set a property it already builds an error message itself reporting which property failed. For example:
10:15:07,901 |-WARN in ch.qos.logback.core.joran.util.PropertySetter@1ffe63b9 - Failed to set property [encoding] to value "foo". ch.qos.logback.core.util.PropertySetterException: java.lang.reflect.InvocationTargetException
at ch.qos.logback.core.util.PropertySetterException: java.lang.reflect.InvocationTargetException
at at ch.qos.logback.core.joran.util.PropertySetter.setProperty(PropertySetter.java:133)
at at ch.qos.logback.core.joran.util.PropertySetter.setProperty(PropertySetter.java:98)
...
Caused by: java.lang.IllegalArgumentException: Unknown encoding foo
at at net.logstash.logback.composite.CompositeJsonFormatter.setEncoding(CompositeJsonFormatter.java:337)
at at net.logstash.logback.encoder.CompositeJsonEncoder.setEncoding(CompositeJsonEncoder.java:234)
at ... 25 common frames omitted
Adding the name of the property in the exception message requires to keep the error message in sync with the name of the corresponding setter method - this may fail in case of refactoring.
It may happen however the exception message must refer to one or more properties by their name. For instance:
Property [foo] cannot be used when property [bar] is set to "value".
In this case, property names must be enclosed between brackets ([...]) to follow the same Logback conventions.
Note: these rules apply to the validation of configuration properties. Other methods not directly used by Joran to set a property are free to use other conventions.
The text was updated successfully, but these errors were encountered:
Rules:
Property must be validated eagerly by the corresponding setter method. An IllegalArgumentException should be thrown when the validation fails. A NullPointerException is currently thrown in most cases for not-null properties - an IllegalStateException should be used instead for consistency.
The exception message often reports the name of the property which is not required. When Joran fails to set a property it already builds an error message itself reporting which property failed. For example:
Adding the name of the property in the exception message requires to keep the error message in sync with the name of the corresponding setter method - this may fail in case of refactoring.
In this case, property names must be enclosed between brackets (
[...]
) to follow the same Logback conventions.Note: these rules apply to the validation of configuration properties. Other methods not directly used by Joran to set a property are free to use other conventions.
The text was updated successfully, but these errors were encountered: