Re: Public info....
You are correct, although one can attempt to cheat a bit and get access to private material by calling the AccessibleObject.setAccessible() method to force an override. (will work unless the JVM has had its SecurityManager permissions tightened up a bit :) )


-don

At 11:51 AM 9/4/2003 -0400, Shapira, Yoav wrote:


Howdy,
Another take on this is BeanUtils#describe(Object bean) which returns a
Map of properties.  Java.util.HashMap's toString() method prints out
very nicely, so you don't have to do much work here.  (I'm talking about
jakarta-commons-beanutils of course ;))

A downside to both the above and I assume Senior Larmee's approach is
that they only invoke public methods, so you don't get private state in
your logging output.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message----- >From: Donald Larmee | ALTERTHOUGHT [mailto:[EMAIL PROTECTED] >Sent: Thursday, September 04, 2003 10:02 AM >To: Log4J Users List >Subject: RE: logging JDBC objects > >In the past I have used a generic bean-util style widget that uses >reflection to introspect any passed Object, and dumps its contents into a >formatted String....which is then in turn logged. > >The DumpUtil (as I have implemented anyway) works well for reasonably >simple/flat Objects, but does not have the smarts to generically >traverse into Collections/arrays. If interested I can post/email. > >-don > > >At 08:47 AM 9/4/2003 -0400, Shapira, Yoav wrote: > > >>Howdy, >>I personally am not a big fan of logging these types of objects: I much >>prefer logging the beans I create from result sets (or DAO objects, or >>whatever we call them this week). However, one possibility for you >>would be to create a ResultSetRenderer (implements >>http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/or/ObjectRen de >>rer.html) >>or a PreparedStatementRenderer... >> >>Yoav Shapira >>Millennium ChemInformatics >> >> >> >-----Original Message----- >> >From: Larry Young [mailto:[EMAIL PROTECTED] >> >Sent: Wednesday, September 03, 2003 8:30 PM >> >To: [EMAIL PROTECTED] >> >Subject: logging JDBC objects >> > >> >Hello, >> > >> > Has anyone looked at logging JDBC objects, like >>PreparedStatement >> >and ResultSet classes? They don't have any built-in ways of displaying >> >their contents, so I'm considering creating a wrapper class to do this >>for >> >me, but I thought I'd check the list to see if anyone else has already >> >solved this problem before I proceed. >> > >> >--- regards --- >> >Larry >> > >> > >> >-------------------------- >> >Larry Young >> >The Dalmatian Group >> >www.dalmatian.com >> > >> > >> > >> >--------------------------------------------------------------------- >> >To unsubscribe, e-mail: [EMAIL PROTECTED] >> >For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >>This e-mail, including any attachments, is a confidential business >>communication, and may contain information that is confidential, >>proprietary and/or privileged. This e-mail is intended only for the >>individual(s) to whom it is addressed, and may not be saved, copied, >>printed, disclosed or used by anyone else. If you are not the(an) >>intended recipient, please immediately delete this e-mail from your >>computer system and notify the sender. Thank you. >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] > > >_______________________________________ > > Donald H. Larmee > ALTERthought, Inc. > 804.301.8867 (c) > > www.alterthought.com >_______________________________________ > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


_______________________________________

  Donald H. Larmee
  ALTERthought, Inc.
  804.301.8867 (c)

  www.alterthought.com
_______________________________________



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to