You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Da...@ubs.com on 2003/10/20 12:55:49 UTC
Useful Object Renderers
Hi all,
I'm wondering whether there are any useful object renderers that I haven't heard about, hopefully downloadable and easily integratable. Things I'd be looking to output without having to have long debugging logic in my code would be beans, JDBC ResultSet rows, and so on. Looking around the log4j codebase all I can see is one jms and one sax renderers, both rather basic.
It seems to me that this would be a very useful feature, improving the quality of usage practice with log4j. Just like layout patterns which allow you to log the locational information and avoid keeping such information in the log messages themselves (and thus having to maintain log messages such as log.debug("entering xyz.foo()") - much better as log.debug("entering")), standard object renderers reduce the complexity of the logging code. For instance, when wanting to output the contents of a bean, it would be nice to be able to just type:
log.debug(myBean);
Given the way object renderers work, that is of course not possible since beans are not subclasses of a particular class. One way to get around that would be for the logger to recognize an org.apache.log4j.BeanWrapper class so that this could be called like:
log.debug(new BeanWrapper(myBean));
In any case, I think the inclusion of more useful standard Object Renderers into the log4j codebase would be a very good thing for log4j, and I'm wondering why this hasn't been done yet. Are there any reasons that I'm not aware of?
Thanks,
Daniel
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org