Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Actual parameter introspection for error logging

Thread Tools

Actual parameter introspection for error logging

David Smith
Posts: n/a

I'd like to write a detailed log following an Exception, that includes
listing the field values of each parameter that was in the list of
actual parameters.

For example, imagine the following methods:

public void callingMethod() {
faultyMethod ("Hello", 99);

public void faultyMethod (String s, int i) {
throw new Exception();

While I'm in this method body, can I use reflection to get a
collection of all the actual parameters somehow, so that I can put a
String representation of them as the message into the Exception? This
would be easier than for each method manually writing the required
code to process the actual parameters.

So in this case, the message would be something like "s=Hello i=99".
User-defined objects can easily be introspected and the fields

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing the name of an actual parameter Hellmut Weber Python 1 01-26-2010 12:01 PM
Outside access to ACTUAL template parameter Frederick Gotham C++ 2 07-02-2006 05:57 AM
logging buffered vs. logging history Christian Roos Cisco 4 02-05-2006 10:55 PM
java.util.logging, where to put janne Java 0 09-10-2004 10:18 AM
[java.util.logging] logging only to _one_ file Stefan Siegl Java 0 08-27-2003 12:29 PM