Customize how some objects are "printed"

19 Jun
2012
19 Jun
'12
11:47 a.m.
Hi everyone, We are used to log the current user. But the current user is a complex object with a ugly "toString()" who print many unuseful informations with new lines. And, of course, we can't override that. To have clean logs, we have to walk into the user object structure until relevant informations and deal with many possibles null pointers. My question is : Is it a way to register something usable by SLF4J to render an object to a String ? Something like : <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> *<renderer class="com.our.company.logging.UserContextRenderer" **/>* </appender>
4854
Age (days ago)
4854
Last active (days ago)
0 comments
1 participants
participants (1)
-
Blaise Gervais