0

I am trying to create a logging OSGi bundle, which would be able to log input, output, exception (if any) parameters of all the methods which are marked with specific annotation.

I have tried to set up the Spring AOP logging in OSGi but I was unsuccessful.

All I need to know is how to determine when the method is being called? For example I have scanned all methods in a class which are annotated with my annotation and I have those methods in array or list.

For example there are three methods: getStatus, getDetails, getSomething. And the user invokes getDetails method, so how should I know when this method is invoked?

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
Paulius Matulionis
  • 23,085
  • 22
  • 103
  • 143
  • http://stackoverflow.com/questions/442747/getting-the-name-of-the-current-executing-method/8592871#8592871 – pb2q Aug 28 '12 at 17:24

1 Answers1

0

Detecting method calls requires you to instrument your code. If you want to do this at runtime this requires byte-code manipulation (which is what Spring AOP does, as far as I know). Alternatively you could instrument your code at compile-time using a custom preprocessing step that generates the instrumented Java-code, but I don't know if that is much easier.

I guess your best bet is to try and Spring AOP working.

Björn Pollex
  • 75,346
  • 28
  • 201
  • 283