Reputation: 11
I am developing a new application and I have to log the method name in the table when a specific method is called, but I have to do this as background process and this process should not affect the application. Please advise how to do this
Upvotes: 0
Views: 833
Reputation: 115388
I think that you are confused with terminology.
Background process is a process that is running without interaction with user. For example you can say that OS services are background processes.
If you want something like this in java program you need background thread. However it seems that it is not what you need now because you want to log each method call, i.e. definitely not background.
So, you can add log int the beginning of each method that will work but sounds a bad idea. Alternatively you can use AOP (e.g. AspectJ) to perform this task. Take a look on any beginning tutorial of AspectJ: this is a classical task to perform with it. TIP: learn a little bit about AspectJ, then move to annotation based implementation.
Upvotes: 1