jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-2998) Option to log the path for Session.save() calls
Date Mon, 20 Jun 2011 15:22:47 GMT

    [ https://issues.apache.org/jira/browse/JCR-2998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052010#comment-13052010
] 

Thomas Mueller commented on JCR-2998:
-------------------------------------

Patch:


Index: src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java	(revision 1137589)
+++ src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java	(working copy)
@@ -19,13 +19,19 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
+import org.apache.jackrabbit.core.ItemImpl;
 import org.apache.jackrabbit.core.id.NodeId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Operation to persist transient changes in a session.
  */
 public class SessionSaveOperation implements SessionWriteOperation<Object> {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SessionSaveOperation.class);
+    private static final boolean LOG_WITH_STACKTRACE = Boolean.getBoolean("org.jackrabbit.logWithStackTrace");
+
     /**
      * Persists transient changes by delegating to the save() method of the
      * root node (or the parent of transient changes if access to the root
@@ -39,6 +45,15 @@
         } else {
             id = context.getItemStateManager().getIdOfRootTransientNodeState();
         }
+        if (LOG.isDebugEnabled()) {
+            NodeId transientRoot = context.getItemStateManager().getIdOfRootTransientNodeState();
+            ItemImpl item = context.getItemManager().getItem(transientRoot);
+            if (LOG_WITH_STACKTRACE) {
+                LOG.debug("Saving changes under " + item.getPath(), new Exception());
+            } else {
+                LOG.debug("Saving changes under " + item.getPath());
+            }
+        }
         context.getItemManager().getItem(id).save();
         return this;
     }


> Option to log the path for Session.save() calls
> -----------------------------------------------
>
>                 Key: JCR-2998
>                 URL: https://issues.apache.org/jira/browse/JCR-2998
>             Project: Jackrabbit Content Repository
>          Issue Type: New Feature
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>
> It would be nice to be able to log the path for Session.save() calls, so that it's easier
to analyze if the repository is slow because of many write operations.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message