Instead of trying to get developers to remember to log each service method call and/or exception, is there a pattern that will proxy to the right service method, in the process logging the call, and trapping/logging any exceptions that are thrown before returning a response back to the caller? I know there is a proxy pattern, but I’m not sure it does what I need it to… if there is a way to create an interface that will better enforce a logging requirement, then I’m open to that as well.
Share
Logging is a cross cutting concern. You can use AOP for that. Have a look at
AspectJorSpring AOP.