We are working on a web application where we are logging input and output of all the database calls in DAO classes. An example is:
@Override
public List<Long> findUsers(final List<Long> userIds) {
LOGGER.info("findUsers: finding user ids by followeeId {} ", userIds);
... // hibernate DB call
LOGGER.info("findUsers: number of ids founds are {}", userIdList.size());
This code will be present inside all the DAO classes, and the number of such classes is around 100, and it may go higher.
My question is shall we continue logging the info in the same way or shall we go for Spring-AspectJ implementation? -We'll have an aspect defined for @Before
and @After
for all such methods. This aspect will call logger and log the required info.
Will implementing Spring-AspectJ be a performance hit? Any pointers are appreciated.
I have gone through the below SO questions, but need some more clarity with respect to the example quoted above.