Expand my Community achievements bar.

How to print to a log file every time when "data" node in the JCR is accessed by CQ code?

Avatar

Level 1

Hello everyone!

We need to find a way to analyze the current CQ dependencies on the /data (jcr node) at runtime.

Our goal would be to create
a logger/mechanism to print the stack trace to a special log file that records every time the "data" node in the JCR is accessed by CQ code.

access to node might be and after call from webpages and from java code

CQ version: CQ 5.6.1

Access mode: and read and write and read/write nested nodes

Performance: not important

Possible ideas on how we might do this:

1)  with help AOP (aspectj library), 

(I think it is more interesting approach but it is most difficult.

In runtime we will need  to implement loadtime weaving for aspects and we will need to solve many difficulties related with access to classes in another bundles with them classpath.

I think AOP advice with pointcut which will intercept all  calls for all methods from all implementations - good solution)

2) through a custom ResourceResolver

3) perhaps an ObservationManager in CQ.

(this approach do not provide ability to log access in time reading because not exist read Event for node and not exist read Event for nested nodes)

(it is need for analyze legacy code/ We will start tests sets witch help to us call our code)

Please help with ideas or code examples. Thank you

1 Reply

Avatar

Employee Advisor

kautuksahni​ Can you please move this thread to AEM sites.