DOes anyone have any good information with regards to when to log, I was thinking of logging an INFO type when i enter each c# method and recording another info when exiting..
Is this considered good or bad? Will i see a performance hit?
If i do record an INFO when i enter a method, the idea would be to record the method name, and all variable and values
Any idea how this can be done automatically without entering each value and name of method, i suppose i could use reflection but maybe i would see a slow down here?
If reflection would slow things down, maybe i could just use the “REFLECTION” bit when there program FAILS hence i can write the stacktrace, all vars, and values.
Any ideas or examples on this really appreciated
Thanks
You could use the AOP (Aspect oriented programming) style of logging for method-level logging.
There is a good framework called Log4PostSharp. It’s a plugin to PostSharp which writes to Log4Net
It basically boils down to decorating your method with an attribute like this: