Dynamic logging of method arguments' value

  • Thread starter Thread starter Bhasker S
  • Start date Start date
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.
 
Back
Top