[GitHub] [sling-org-apache-sling-servlets-post] joerghoh commented on a diff in pull request #22: SLING-11971 Adding additional logging for sling post processors

2023-07-21 Thread via GitHub


joerghoh commented on code in PR #22:
URL: 
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/22#discussion_r1270604051


##
src/main/java/org/apache/sling/servlets/post/impl/operations/ModifyOperation.java:
##
@@ -70,31 +76,54 @@ public void setDateParser(final DateParser dateParser) {
 
 @Override
 protected void doRun(final SlingHttpServletRequest request,
-final PostResponse response,
-final List changes)
-throws PersistenceException {
+final PostResponse response,
+final List changes)
+throws PersistenceException {
 final Map reqProperties = 
collectContent(request, response);
 
 final VersioningConfiguration versioningConfiguration = 
getVersioningConfiguration(request);
 
 // do not change order unless you have a very good reason.
+Instant start = Instant.now();
 
 // ensure root of new content
 processCreate(request.getResourceResolver(), reqProperties, response, 
changes, versioningConfiguration);
+logger.debug("Performed create at {} path took {} ms to operate", 
request.getRequestURI(),

Review Comment:
   I don't think that it is necessary to consistently add the value of 
``request.getRequestURI()`` to the message. This information is always part of 
the context of the RequestProgressTracker, and also it won't change while 
execution it, it's static.
   On top of that, ``Performed create at``  could be understood that a create 
is executed at this path, and this is not consistently true, as other resources 
could be affected, too (for example sub-resources).
   
   I would just remove this part of the log.



##
src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java:
##
@@ -167,13 +176,15 @@ public void run(final SlingHttpServletRequest request,
 
 if (isSessionSaveRequired(session, request)) {
 request.getResourceResolver().commit();
+log.debug("Saved the session");
 }
 
 if (!isSkipCheckin(request)) {
 // now do the checkins
 for(String checkinPath : nodesToCheckin) {
 if (checkin(request.getResourceResolver(), checkinPath)) {
 response.onChange("checkin", checkinPath);
+log.debug("Checked in the node");

Review Comment:
   same as above



##
src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java:
##
@@ -167,13 +176,15 @@ public void run(final SlingHttpServletRequest request,
 
 if (isSessionSaveRequired(session, request)) {
 request.getResourceResolver().commit();
+log.debug("Saved the session");

Review Comment:
   same as above



##
src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java:
##
@@ -127,6 +135,7 @@ public void run(final SlingHttpServletRequest request,
 }
 
 // fail if any of the base paths (before the postfix) which had a 
postfix are contained in the modification set
+log.debug("Fail if any of the base paths (before the postfix) 
which had a postfix are contained in the modification set");

Review Comment:
   What is the purpose of this statement? Is it just for the purpose of having 
a timestamp (assuming the log is properly configured to write mili/micro-second 
level timestamps)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-servlets-post] joerghoh commented on a diff in pull request #22: SLING-11971 Adding additional logging for sling post processors

2023-07-19 Thread via GitHub


joerghoh commented on code in PR #22:
URL: 
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/22#discussion_r1267653540


##
src/main/java/org/apache/sling/servlets/post/impl/operations/AbstractPostOperation.java:
##
@@ -106,7 +108,10 @@ public void run(final SlingHttpServletRequest request,
 try {
 if (processors != null) {
 for (SlingPostProcessor processor : processors) {
+Instant start = Instant.now();
+log.debug("About to perform processor {}", 
processor.getClass().getName());
 processor.process(request, changes);
+log.debug("Performed processor {} in {}", 
processor.getClass().getName(), Duration.between(start, 
Instant.now()).toMillis());

Review Comment:
   can you please also log into the RequestProgressTracker?



##
src/main/java/org/apache/sling/servlets/post/AbstractPostOperation.java:
##
@@ -108,11 +112,15 @@ public void run(final SlingHttpServletRequest request,
 // invoke processors
 if (processors != null) {
 for (SlingPostProcessor processor : processors) {
+Instant start = Instant.now();
+log.debug("About to perform processor {}", 
processor.getClass().getName());
 processor.process(request, changes);
+log.debug("Performed processor {} in {}", 
processor.getClass().getName(), Duration.between(start, 
Instant.now()).toMillis());

Review Comment:
   Can you please also log this message to the RequestProgressTracker?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org