Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse plugin for Java that automatically adds logging events

I want to add a plugin to my Eclipse(Helios) which logs my function start and end. To be more precise, I'm looking for something like this.

TestClass {

    private static final Logger logger = Logger.getLog("TestClass");

    public void displayHello () {
        System.out.println("Fooo");
    }
}

After I add the plugin and enable functional logging,Im expecting the following

TestClass {
  private static final Logger logger = Logger.getLog("TestClass");
   public void displayHello () {
     logger.debug ("displayHello() - Started");
     System.out.println("Fooo");
     logger.debug ("displayHello() - Ended");
   }
 }

I remember using some method to obtain the same earlier but am unable to recollect the same now.Can anyone help me out with this?

Thanks Anish

like image 611
Anish Avatar asked Jul 18 '26 04:07

Anish


1 Answers

You should look at AspectJ and Spring AOP its supports something like this,

execution(* com.java.test..*.*(..))

which will cover all methods in all sub-packages of project. So no need to define all methods one by one.

like image 70
Jayamohan Avatar answered Jul 20 '26 16:07

Jayamohan