Dynamic logging of method arguments' value

B

Bhasker S

Hi,

Typically, when an exception is caught, we log the stack trace. However,
that is not of much use unless you know the value of the arguments passed to
the methods in the stack trace.

Does the .NET framework provide a mechanism wherein values of the method
argument can be determined dynamically (say using reflection)?

Of course, in each method in my code I can manually log values of the method
arguments but that'll be tedious and I'll need to change that code everytime
I introduce a new argument/change an argument.Also, if I'm logging these
details in many places (ex : in multiple 'catch' blocks) then code changes
are needed in multiple places.

Cheers,
Bhasker.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top