jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1099822 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java
Date Thu, 05 May 2011 14:31:22 GMT
Author: thomasm
Date: Thu May  5 14:31:22 2011
New Revision: 1099822

URL: http://svn.apache.org/viewvc?rev=1099822&view=rev
Log:
JCR-2961: Improve logging of Session.save() to trace back root cause of externally modified
nodes

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java?rev=1099822&r1=1099821&r2=1099822&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionSaveOperation.java
Thu May  5 14:31:22 2011
@@ -19,13 +19,19 @@ package org.apache.jackrabbit.core.sessi
 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 @@ public class SessionSaveOperation implem
         } 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;
     }



Mime
View raw message