Class AccessLogger
java.lang.Object
org.apache.sling.jcr.resource.internal.helper.AccessLogger
- All Implemented Interfaces:
Closeable
,AutoCloseable
Helper class to report on repository access.
The focus is to have a less overhead as possible if it is not used; in case it is enabled and access
is logged, the performance overhead does not matter.
In the current implementation it has 2 features:
* Write a stacktrace on every recorded operation; this comes with a massive overhead and it is definitely
not recommended to turn this on on production, since it can easily create 100s of megabytes of log and will slow
down processing massively. To use this turn on TRACE logging on 'org.apache.sling.jcr.resource.AccessLogger.operation'
* When a resource resolver is closed, dump a single log statement about the number of recorded operations. The overhead is
very small and it can be turned on for a longer period of time also in production. To use it enable DEBUG logging on
'org.apache.sling.jcr.resource.AccessLogger.statistics'.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static void
incrementUsage
(ResourceResolver resolver, String operation, String path) static void
incrementUsage
(ResourceResolver resolver, String operation, String path, long count) static void
incrementUsage
(Resource resource, String operation) static void
incrementUsage
(Resource resource, String operation, long count) toString()
-
Method Details
-
incrementUsage
-
incrementUsage
-
incrementUsage
-
incrementUsage
public static void incrementUsage(ResourceResolver resolver, String operation, String path, long count) -
toString
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-