How will I add logging to every procedure in C# or VB.Net?

We just upgraded an application using the upgrade tool. I want to add a common procedure to all these procedures (Visual studio 2005, C# or VB.Net), Example I want to add logging and I would add "MyLogger.LogThisProcedure()" to every procedure. But it will take time for me to add this in every procedure I want to log because it was so big. Is there an add-in I can easily use to automate this, and how do I use this add-in?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ronak PatelCommented:

There is nice tool available to use for .Net Application Event Logging.

Please refer below :
A Brief Introduction to the log4net logging library, using C#
log4net Tutorial

stylelyfAuthor Commented:
Thanks. I plan to use this. But is there a way to automate the insertion of these class call to every procedure in my project classes?


logger.Debug("Here is a debug log.");
logger.Info("... and an Info log.");
logger.Warn("... and a warning.");
logger.Error("... and an error.");
logger.Fatal("... and a fatal error.");

Open in new window

... then some kind of automatic insertion tool to insert above logger calls to my thousand procedures?
Éric MoreauSenior .Net ConsultantCommented:
It is a good time for you to discover AOP (Aspect oriented programming) available in .Net by using some tools. Have a look at

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ronak PatelCommented:

Here is another Logging framework which would minimize your coding efforts, but you have to apply the logger on every method you want to log.

See the demo here: Log4PostSharp - AOP and logging

Hope this helps.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.