Reputation: 255
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
Upvotes: 3
Views: 751
Reputation: 28737
Since the question is about Eclipse plugins, I am assuming that the places you want to log do not necessarily exist in a single plugin. AspectJ is a good suggestion. However, standard AspectJ or Spring AOP will not be sufficient since it is classloader based. You will need to use Equinox Weaving.
Equinox Weaving performs load-time weaving in an OSGi-aware way. Essentially, you create your plugins and augment your manifest files with the proper weaving configuration.
Upvotes: 0
Reputation: 12924
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.
Upvotes: 2