Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8094149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:42:19+00:00 2026-06-05T20:42:19+00:00

i need to log each method call in my application. i dont want to

  • 0

i need to log each method call in my application.
i dont want to repeat code in each method of the business layer

i have been looking at the AOP approach which seems to be the best option right now but i have no idea how to use this method.

any suggestions or links articles or examples would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:42:21+00:00Added an answer on June 5, 2026 at 8:42 pm

    You can use PostSharp which is an APO infrastructure and you have a nice example on that link for ways of using it.

    If you need any logging infrastructure too you can use log4net.

    From the links above, you can see the log attribute example that you can just modify for using a logging infrastructure as well:

    [Serializable]
    public class LogAspect : OnMethodBoundaryAspect
    {
        public override void OnEntry(MethodExecutionArgs args)
        {
            Console.WriteLine(Environment.NewLine);
    
            Console.WriteLine("Entering [ {0} ] ...", args.Method);
    
            base.OnEntry(args);
        }
    
        public override void OnExit(MethodExecutionArgs args)
        {
            Console.WriteLine("Leaving [ {0} ] ...", args.Method);
    
            base.OnExit(args);
        }
    }
    

    using it on your code:

    [LogAspect]
    public void SomeMethod()
    {
    }
    

    which will log on SomeMethod call

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C# code, I want create a log file for each each method in
Say I have a web service that works with a database. Each method opens
For security reasons I need the user to log in each time my app
We have a system which is composed of few applications. Each application at certain
I'm writing a log collection / analysis application in Python and I need to
I want to log every user action that change domain in my web application.
I am developing a Windows Service application of some complexity, and need to have
I'm working on a internal web application (only employees can log in) and need
I was halfway of changing my code to print a Log message each time
I need to trigger the {{showAlias}} view method from within the {{#each content.activitytypes}} I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.