directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1417547 - in /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap: LdapServer.java replication/consumer/PingerThread.java replication/consumer/ReplicationConsumerImpl.java
Date Wed, 05 Dec 2012 17:32:56 GMT
Author: elecharny
Date: Wed Dec  5 17:32:55 2012
New Revision: 1417547

URL: http://svn.apache.org/viewvc?rev=1417547&view=rev
Log:
Added NDC to add some incormation about the consumer in the logs. We now know which consumer
is logging what.

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1417547&r1=1417546&r2=1417547&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Wed Dec  5 17:32:55 2012
@@ -102,6 +102,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.UnbindRequest;
 import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.util.Strings;
+import org.apache.log4j.NDC;
 import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
 import org.apache.mina.core.filterchain.IoFilterChainBuilder;
 import org.apache.mina.core.future.WriteFuture;
@@ -707,6 +708,12 @@ public class LdapServer extends Director
                         {
                             while ( true )
                             {
+                                if ( CONSUMER_LOG.isDebugEnabled() )
+                                {
+                                    NDC.pop();
+                                    NDC.push( consumer.getId() );
+                                }
+                                
                                 LOG.info( "starting the replication consumer with {}", consumer
);
                                 CONSUMER_LOG.info( "starting the replication consumer with
{}", consumer );
                                 boolean isConnected = consumer.connect( ReplicationConsumer.NOW
);

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java?rev=1417547&r1=1417546&r2=1417547&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/PingerThread.java
Wed Dec  5 17:32:55 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.ldap
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
+import org.apache.log4j.NDC;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,7 +58,13 @@ public class PingerThread extends Thread
     {
         try
         {
-            CONSUMER_LOG.debug( "Starting the provider's pinger" );
+            if ( CONSUMER_LOG.isDebugEnabled() )
+            {
+                NDC.pop();
+                NDC.push( "Pinger" );
+                
+                CONSUMER_LOG.debug( "Starting the provider's pinger" );
+            }
 
             while ( !stop )
             {

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1417547&r1=1417546&r2=1417547&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
Wed Dec  5 17:32:55 2012
@@ -89,6 +89,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.util.Strings;
+import org.apache.log4j.NDC;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -274,6 +275,7 @@ public class ReplicationConsumerImpl imp
      */
     private void prepareSyncSearchRequest() throws LdapException
     {
+        NDC.pop();
         String baseDn = config.getBaseDn();
 
         searchRequest = new SearchRequestImpl();
@@ -295,7 +297,11 @@ public class ReplicationConsumerImpl imp
                 new ManageDsaITImpl() ) );
         }
         
-        CONSUMER_LOG.debug( "Configuring consumer {}", config );
+        if ( CONSUMER_LOG.isDebugEnabled() )
+        {
+            NDC.push( Integer.toString( config.getReplicaId() ) );
+            CONSUMER_LOG.debug( "Configuring consumer {}", config );
+        }
     }
 
 
@@ -528,7 +534,12 @@ public class ReplicationConsumerImpl imp
      */
     public void connectionClosed()
     {
-        CONSUMER_LOG.debug( "Consumer {} session with {} has been closed ", config.getReplicaId(),
config.getProducer() );
+        if ( CONSUMER_LOG.isDebugEnabled() )
+        {
+            NDC.pop();
+            NDC.push( Integer.toString( config.getReplicaId() ) );
+            CONSUMER_LOG.debug( "Consumer {} session with {} has been closed ", config.getReplicaId(),
config.getProducer() );
+        }
         
         // Cleanup
         disconnected = true;
@@ -884,7 +895,13 @@ public class ReplicationConsumerImpl imp
     
                 connection.unBind();
                 LOG.info( "Unbound from the server {}", config.getProducer() );
-                CONSUMER_LOG.info( "Unbound from the server {}", config.getProducer() );
+                
+                if ( CONSUMER_LOG.isDebugEnabled() )
+                {
+                    NDC.pop();
+                    NDC.push( Integer.toString( config.getReplicaId() ) );
+                    CONSUMER_LOG.info( "Unbound from the server {}", config.getProducer()
);
+                }
     
                 connection.close();
                 LOG.info( "Connection closed for the server {}", config.getProducer() );



Mime
View raw message