directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1480222 - in /directory: apacheds/trunk/core-integ/src/test/resources/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/ ap...
Date Wed, 08 May 2013 10:54:27 GMT
Author: elecharny
Date: Wed May  8 10:54:26 2013
New Revision: 1480222

URL: http://svn.apache.org/r1480222
Log:
o Added a logger for operation time 
o Added a dedicated logger for codec
o Fixed the dedicated loggers
o Fixed some log4j.properties files
o Added the dump of encoded requests in codec, using the CODEC_LOG dedicated logger

Modified:
    directory/apacheds/trunk/core-integ/src/test/resources/log4j.properties
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
    directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
    directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/Loggers.java
    directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolDecoder.java
    directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolEncoder.java

Modified: directory/apacheds/trunk/core-integ/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/resources/log4j.properties?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/trunk/core-integ/src/test/resources/log4j.properties Wed May  8 10:54:26
2013
@@ -14,21 +14,22 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=OFF, stdout
+log4j.rootCategory=FATAL, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
 #log4j.logger.org=FATAL
-log4j.logger.org.apache.directory.api.ldap.model.schema=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.JdbmTable=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.JdbmIndex=FATAL
 log4j.logger.jdbm.recman.BaseRecordManager=FATAL
-log4j.logger.org.apache.directory.LOG_CHANGES=FATAL
-log4j.logger.org.apache.directory.ACI_LOG=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.jdbm.DupsCursor=FATAL
-log4j.logger.org.apache.directory.PROVIDER_LOG=FATAL
-log4j.logger.org.apache.directory.CONSUMER_LOG=FATAL
-log4j.logger.org.apache.directory.CURSOR=FATAL
-log4j.logger.org.apache.directory.api.asn1=FATAL
+log4j.logger.org.apache.directory.server.OPERATIONS_LOG=FATAL
+log4j.logger.org.apache.directory.server.OPERATION_TIME=DEBUG
+log4j.logger.org.apache.directory.api.CODEC_LOG=FATAL
+log4j.logger.org.apache.directory.server.ACI_LOG=FATAL
+log4j.logger.org.apache.directory.server.PROVIDER_LOG=FATAL
+log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
+log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
+log4j.logger.org.apache.directory.api=FATAL
+log4j.logger.org.apache.directory.server=FATAL
+log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.apache.mina=FATAL

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
Wed May  8 10:54:26 2013
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -73,14 +74,19 @@ import org.slf4j.LoggerFactory;
  */
 public class DefaultOperationManager implements OperationManager
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( DefaultOperationManager.class
);
+    /** A logger specifically for operations */
+    private static final Logger OPERATION_LOG = LoggerFactory.getLogger( Loggers.OPERATION_LOG.getName()
);
 
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+    /** A logger specifically for operations time */
+    private static final Logger OPERATION_TIME = LoggerFactory.getLogger( Loggers.OPERATION_TIME.getName()
);
+
+    /** A logger specifically for operations statistics */
+    private static final Logger OPERATION_STAT = LoggerFactory.getLogger( Loggers.OPERATION_STAT.getName()
);
 
-    /** A logger specifically for change operations */
-    private static final Logger LOG_CHANGES = LoggerFactory.getLogger( "LOG_CHANGES" );
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = OPERATION_LOG.isDebugEnabled();
+    private static final boolean IS_TIME = OPERATION_TIME.isDebugEnabled();
+    private static final boolean IS_STAT = OPERATION_STAT.isDebugEnabled();
 
     /** The directory service instance */
     private final DirectoryService directoryService;
@@ -323,8 +329,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> AddOperation : {}", addContext );
-            LOG_CHANGES.debug( ">> AddOperation : {}", addContext );
+            OPERATION_LOG.debug( ">> AddOperation : {}", addContext );
+        }
+
+        long addStart = 0L;
+
+        if ( IS_TIME )
+        {
+            addStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -379,8 +391,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< AddOperation successful" );
-            LOG_CHANGES.debug( "<< AddOperation successful" );
+            OPERATION_LOG.debug( "<< AddOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Add operation took " + ( System.nanoTime() - addStart
) + " ns" );
         }
     }
 
@@ -392,7 +408,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> BindOperation : {}", bindContext );
+            OPERATION_LOG.debug( ">> BindOperation : {}", bindContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -413,7 +436,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< BindOperation successful" );
+            OPERATION_LOG.debug( "<< BindOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Bind operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 
@@ -425,7 +453,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> CompareOperation : {}", compareContext );
+            OPERATION_LOG.debug( ">> CompareOperation : {}", compareContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -501,7 +536,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< CompareOperation successful" );
+            OPERATION_LOG.debug( "<< CompareOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Compare operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
 
         return result;
@@ -515,8 +555,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> DeleteOperation : {}", deleteContext );
-            LOG_CHANGES.debug( ">> DeleteOperation : {}", deleteContext );
+            OPERATION_LOG.debug( ">> DeleteOperation : {}", deleteContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -592,8 +638,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< DeleteOperation successful" );
-            LOG_CHANGES.debug( "<< DeleteOperation successful" );
+            OPERATION_LOG.debug( "<< DeleteOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Delete operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 
@@ -605,7 +655,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> GetRootDseOperation : {}", getRootDseContext );
+            OPERATION_LOG.debug( ">> GetRootDseOperation : {}", getRootDseContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -616,7 +673,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< getRootDseOperation successful" );
+            OPERATION_LOG.debug( "<< getRootDseOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "GetRootDSE operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
 
         return root;
@@ -630,7 +692,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> hasEntryOperation : {}", hasEntryContext );
+            OPERATION_LOG.debug( ">> hasEntryOperation : {}", hasEntryContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -652,7 +721,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< HasEntryOperation successful" );
+            OPERATION_LOG.debug( "<< HasEntryOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "HasEntry operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
 
         return result;
@@ -666,7 +740,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> LookupOperation : {}", lookupContext );
+            OPERATION_LOG.debug( ">> LookupOperation : {}", lookupContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -688,7 +769,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< LookupOperation successful" );
+            OPERATION_LOG.debug( "<< LookupOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Lookup operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
 
         return entry;
@@ -702,8 +788,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> ModifyOperation : {}", modifyContext );
-            LOG_CHANGES.debug( ">> ModifyOperation : {}", modifyContext );
+            OPERATION_LOG.debug( ">> ModifyOperation : {}", modifyContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -788,8 +880,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< ModifyOperation successful" );
-            LOG_CHANGES.debug( "<< ModifyOperation successful" );
+            OPERATION_LOG.debug( "<< ModifyOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Modify operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 
@@ -801,8 +897,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> MoveOperation : {}", moveContext );
-            LOG_CHANGES.debug( ">> MoveOperation : {}", moveContext );
+            OPERATION_LOG.debug( ">> MoveOperation : {}", moveContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -897,8 +999,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< MoveOperation successful" );
-            LOG_CHANGES.debug( "<< MoveOperation successful" );
+            OPERATION_LOG.debug( "<< MoveOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Move operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 
@@ -910,8 +1016,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> MoveAndRenameOperation : {}", moveAndRenameContext );
-            LOG_CHANGES.debug( ">> MoveAndRenameOperation : {}", moveAndRenameContext
);
+            OPERATION_LOG.debug( ">> MoveAndRenameOperation : {}", moveAndRenameContext
);
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -1006,8 +1118,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< MoveAndRenameOperation successful" );
-            LOG_CHANGES.debug( "<< MoveAndRenameOperation successful" );
+            OPERATION_LOG.debug( "<< MoveAndRenameOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "MoveAndRename operation took " + ( System.nanoTime() -
opStart ) + " ns" );
         }
     }
 
@@ -1019,8 +1135,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> RenameOperation : {}", renameContext );
-            LOG_CHANGES.debug( ">> RenameOperation : {}", renameContext );
+            OPERATION_LOG.debug( ">> RenameOperation : {}", renameContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -1111,8 +1233,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< RenameOperation successful" );
-            LOG_CHANGES.debug( "<< RenameOperation successful" );
+            OPERATION_LOG.debug( "<< RenameOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Rename operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 
@@ -1124,7 +1250,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> SearchOperation : {}", searchContext );
+            OPERATION_LOG.debug( ">> SearchOperation : {}", searchContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -1203,7 +1336,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< SearchOperation successful" );
+            OPERATION_LOG.debug( "<< SearchOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Search operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
 
         return cursor;
@@ -1217,7 +1355,14 @@ public class DefaultOperationManager imp
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( ">> UnbindOperation : {}", unbindContext );
+            OPERATION_LOG.debug( ">> UnbindOperation : {}", unbindContext );
+        }
+
+        long opStart = 0L;
+
+        if ( IS_TIME )
+        {
+            opStart = System.nanoTime();
         }
 
         ensureStarted();
@@ -1235,7 +1380,12 @@ public class DefaultOperationManager imp
 
         if ( IS_DEBUG )
         {
-            LOG.debug( "<< UnbindOperation successful" );
+            OPERATION_LOG.debug( "<< UnbindOperation successful" );
+        }
+
+        if ( IS_TIME )
+        {
+            OPERATION_TIME.debug( "Unbind operation took " + ( System.nanoTime() - opStart
) + " ns" );
         }
     }
 

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
(original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/log4j.properties
Wed May  8 10:54:26 2013
@@ -32,7 +32,16 @@ log4j.appender.R.layout.ConversionPatter
 log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
 # with these we'll not get innundated when switching to DEBUG
-log4j.logger.org.apache.directory.api.ldap.name=WARN
-log4j.logger.org.apache.directory.api.codec=WARN
-log4j.logger.org.apache.directory.api.asn1=WARN
+log4j.logger.jdbm.recman.BaseRecordManager=FATAL
+log4j.logger.org.apache.directory.server.OPERATIONS_LOG=FATAL
+log4j.logger.org.apache.directory.server.OPERATION_TIME=FATAL
+log4j.logger.org.apache.directory.api.CODEC_LOG=FATAL
+log4j.logger.org.apache.directory.server.ACI_LOG=FATAL
+log4j.logger.org.apache.directory.server.PROVIDER_LOG=FATAL
+log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
+log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
+log4j.logger.org.apache.directory.api=FATAL
+log4j.logger.org.apache.directory.server=FATAL
+log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.apache.mina=FATAL
 

Modified: directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties Wed May  8 10:54:26
2013
@@ -29,21 +29,15 @@ log4j.appender.file.MaxFileSize=7168KB
 log4j.appender.file.MaxBackupIndex=100
 
 #log4j.logger.org=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.JdbmTable=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.JdbmIndex=FATAL
 log4j.logger.jdbm.recman.BaseRecordManager=FATAL
-log4j.logger.org.apache.directory.LOG_CHANGES=FATAL
-log4j.logger.org.apache.directory.ACI_LOG=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl.btree.jdbm.DupsCursor=FATAL
+log4j.logger.org.apache.directory.server.OPERATIONS_LOG=FATAL
+log4j.logger.org.apache.directory.server.OPERATION_TIME=FATAL
+log4j.logger.org.apache.directory.api.CODEC_LOG=FATAL
+log4j.logger.org.apache.directory.server.ACI_LOG=FATAL
+log4j.logger.org.apache.directory.server.PROVIDER_LOG=FATAL
+log4j.logger.org.apache.directory.server.CONSUMER_LOG=FATAL
 log4j.logger.org.apache.directory.CURSOR_LOG=FATAL
-log4j.logger.org.apache.directory.api.asn1.ber=FATAL
-log4j.logger.org.apache.directory.server.core.partition.ldif=FATAL
-log4j.logger.org.apache.directory.api.ldap=FATAL
-log4j.logger.org.apache.directory.api.util.Strings=FATAL
-log4j.logger.org.apache.directory.server.core.partition.impl=FATAL
-log4j.logger.org.apache.directory.server.core.admin=FATAL
-log4j.logger.org.apache.directory.ldap.client.api=FATAL
-log4j.logger.org.apache.directory.server.ldap.replication.provider=FATAL
-log4j.logger.org.apache.directory.PROVIDER_LOG=FATAL
-log4j.logger.org.apache.directory.CONSUMER_LOG=FATAL
-log4j.logger.org.apache.directory.server.replication.MockSyncReplConsumer=FATAL
+log4j.logger.org.apache.directory.api=FATAL
+log4j.logger.org.apache.directory.server=FATAL
+log4j.logger.net.sf.ehcache=FATAL
+log4j.logger.org.apache.mina=FATAL

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/Loggers.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/Loggers.java?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/Loggers.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/Loggers.java
Wed May  8 10:54:26 2013
@@ -23,9 +23,17 @@ package org.apache.directory.api.ldap.mo
 /**
  * An enum defining a list of dedicated loggers, used for debugging
  * purpose :
- * - ACI_LOG
- * - (more to come)
- *
+ * <ul>
+ * <li>ACI_LOG : Logs on teh ACI processing</li>
+ * <li>CONSUMER_LOG : Logs on the replication consummer</li>
+ * <li>CURSOR_LOG : Logs on search cursors</li>
+ * <li>PROVIDER_LOG : Logs on the replication provider</li>
+ * <li>OPERATION_STAT : Logs on the operations statistics</li>
+ * <li>OPERATION_TIME : Logs on the time it takes to process an operation</li>
+ * <li>KERBEROS_LOG : Logs on Kerberos</li>
+ * <li>CODEC_LOG : Logs on encoder/decoder</li>
+ * <li>OPERATIONS_LOG: Logs on LDAP operations</li>
+ * </ul>
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum Loggers
@@ -49,7 +57,13 @@ public enum Loggers
     OPERATION_TIME("org.apache.directory.server.OPERATION_TIME"),
 
     /** The dedicated logger for KERBEROS */
-    KERBEROS_LOG("org.apache.directory.server.KERBEROS_LOG");
+    KERBEROS_LOG("org.apache.directory.server.KERBEROS_LOG"),
+
+    /** The dedicated logger for LDAP operations */
+    OPERATION_LOG("org.apache.directory.server.OPERATION_LOG"),
+
+    /** The dedicated logger for CODEC */
+    CODEC_LOG("org.apache.directory.api.CODEC_LOG");
 
     /** The associated name */
     private String name;

Modified: directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolDecoder.java?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolDecoder.java
(original)
+++ directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolDecoder.java
Wed May  8 10:54:26 2013
@@ -31,6 +31,7 @@ import org.apache.directory.api.ldap.cod
 import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
 import org.apache.directory.api.ldap.codec.api.MessageDecorator;
 import org.apache.directory.api.ldap.codec.api.ResponseCarryingException;
+import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.exception.ResponseCarryingMessageException;
 import org.apache.directory.api.ldap.model.message.Message;
 import org.apache.directory.api.util.Strings;
@@ -50,10 +51,10 @@ import org.slf4j.LoggerFactory;
 public class LdapProtocolDecoder implements ProtocolDecoder
 {
     /** The logger */
-    private static Logger LOG = LoggerFactory.getLogger( LdapDecoder.class );
+    private static final Logger CODEC_LOG = LoggerFactory.getLogger( Loggers.CODEC_LOG.getName()
);
 
     /** A speedup for logger */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+    private static final boolean IS_DEBUG = CODEC_LOG.isDebugEnabled();
 
     /** The ASN 1 decoder instance */
     private Asn1Decoder asn1Decoder;
@@ -121,7 +122,7 @@ public class LdapProtocolDecoder impleme
             {
                 if ( IS_DEBUG )
                 {
-                    LOG.debug( "Decoding the PDU : " );
+                    CODEC_LOG.debug( "Decoding the PDU : " );
 
                     int size = buffer.limit();
                     int position = buffer.position();
@@ -133,11 +134,11 @@ public class LdapProtocolDecoder impleme
 
                     if ( array.length == 0 )
                     {
-                        LOG.debug( "NULL buffer, what the HELL ???" );
+                        CODEC_LOG.debug( "NULL buffer, what the HELL ???" );
                     }
                     else
                     {
-                        LOG.debug( Strings.dumpBytes( array ) );
+                        CODEC_LOG.debug( Strings.dumpBytes( array ) );
                     }
                 }
 
@@ -147,7 +148,7 @@ public class LdapProtocolDecoder impleme
                 {
                     if ( IS_DEBUG )
                     {
-                        LOG.debug( "Decoded LdapMessage : " + messageContainer.getMessage()
);
+                        CODEC_LOG.debug( "Decoded LdapMessage : " + messageContainer.getMessage()
);
                     }
 
                     Message message = messageContainer.getMessage();

Modified: directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolEncoder.java?rev=1480222&r1=1480221&r2=1480222&view=diff
==============================================================================
--- directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolEncoder.java
(original)
+++ directory/shared/trunk/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolEncoder.java
Wed May  8 10:54:26 2013
@@ -24,11 +24,15 @@ import java.nio.ByteBuffer;
 
 import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
 import org.apache.directory.api.ldap.codec.api.LdapEncoder;
+import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.message.Message;
+import org.apache.directory.api.util.Strings;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,6 +42,12 @@ import org.apache.mina.filter.codec.Prot
  */
 public class LdapProtocolEncoder implements ProtocolEncoder
 {
+    /** logger for reporting errors that might not be handled properly upstream */
+    private static final Logger CODEC_LOG = LoggerFactory.getLogger( Loggers.CODEC_LOG.getName()
);
+
+    /** A speedup for logger */
+    private static final boolean IS_DEBUG = CODEC_LOG.isDebugEnabled();
+
     /** The stateful encoder */
     private LdapEncoder encoder;
 
@@ -62,6 +72,14 @@ public class LdapProtocolEncoder impleme
 
         IoBuffer ioBuffer = IoBuffer.wrap( buffer );
 
+        if ( IS_DEBUG )
+        {
+            byte[] dumpBuffer = new byte[buffer.limit()];
+            buffer.get( dumpBuffer );
+            buffer.flip();
+            CODEC_LOG.debug( "Encoded message \n " + message + "\n : " + Strings.dumpBytes(
dumpBuffer ) );
+        }
+
         out.write( ioBuffer );
     }
 



Mime
View raw message