support for accessing fields and methods without parameters of an object in...
one cross-cutting concern less to worry about
Brought to you by:
yilativs
probably it can be useful to let access fields and methods without parameters of an object in log expressions
e.g
${args[0].someMethod()}
or
${args[0].someField}
on the other side forcing programmer to use getters for field acceess is good practice.
This ticket is under consideration and won't go to initial release
aslo consider addign expressions
e.g ${args[0].property=true}
to implement this we will have to use StringTemplate or FreeMarker,
the cons of this approach is that it can make the logging the cause of an error, and it is never a good idea.
Vitaliy, it's could be very usefull. For example I don't want to logging full collection, I just want's to logging size ("args[0].size()"). I reccomend to make it as a plugin, with default implementation (current). Or it can be integrate it with spring-expressions, if Spring-exp contains in a classpath.
On first access:
on logging time:
instead of LogFormatter::
private String toString(Object bean, String property)300:
toString(stringBuilder, PropertyUtils.getProperty(bean, property));can be replaced to
toString(stringBuilder, expression.getValue(bean))(or to the plugin call)