What is the ideal code to logging ratio? I’m not used to writing logs as most of the applications I’ve developed have not had much logging.
Recently though I’ve changed job, and I’ve noticed that you can’t see the application code for the calls to log4net. I appreciate that this is useful but surely having too many debug statements is just as bad as not having any at all?
There are logging statements that tell you when every method starts and finishes and what they are returning. and when pretty much anything is done.
Would it not be easier to have some addon that used reflection to add the logging statements in at compile time so they didn’t get in the way as you were trying to look at the code?
Also in these days of powerful IDEs and remote debugging is that much logging really nescisary?
There is actually a nice library for adding in logging after the fact as you say, PostSharp. It lets you do it via attribute-based programming, among many other very useful things beyond just logging.
I agree that what you say is a little excessive for logging.
Some others bring up some good points, especially the banking scenario and other mission critical apps. It may be necessary for extreme logging, or at least be able to turn it on and off if needed, or have various levels set.