You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2011/06/20 17:22:47 UTC

[jira] [Created] (JCR-2998) Option to log the path for Session.save() calls

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

        

[jira] [Commented] (JCR-2998) Option to log the path for Session.save() calls

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Resolved] (JCR-2998) Option to log the path for Session.save() calls

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller resolved JCR-2998.
---------------------------------

    Resolution: Won't Fix

We have SessionState debug logging options, I don't think we need anything else.
                
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira