directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1417899 - in /directory/apacheds/trunk: protocol-ldap/src/main/java/org/apache/directory/server/ldap/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ server-integ/src/test/resources/
Date Thu, 06 Dec 2012 14:19:40 GMT
Author: elecharny
Date: Thu Dec  6 14:19:38 2012
New Revision: 1417899

URL: http://svn.apache.org/viewvc?rev=1417899&view=rev
Log:
So NDC does not work in slf4j, replaced it with MDC

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
    directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties

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=1417899&r1=1417898&r2=1417899&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
Thu Dec  6 14:19:38 2012
@@ -32,9 +32,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Queue;
 import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
 import javax.net.ssl.KeyManagerFactory;
 
@@ -102,7 +100,6 @@ 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;
@@ -118,6 +115,7 @@ import org.apache.mina.transport.socket.
 import org.apache.mina.transport.socket.SocketAcceptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 
 /**
@@ -710,8 +708,7 @@ public class LdapServer extends Director
                             {
                                 if ( CONSUMER_LOG.isDebugEnabled() )
                                 {
-                                    NDC.pop();
-                                    NDC.push( consumer.getId() );
+                                    MDC.put( "Replica", consumer.getId() );
                                 }
                                 
                                 LOG.info( "starting the replication consumer with {}", consumer
);

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=1417899&r1=1417898&r2=1417899&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
Thu Dec  6 14:19:38 2012
@@ -22,8 +22,8 @@ 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.MDC;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -60,8 +60,7 @@ public class PingerThread extends Thread
         {
             if ( CONSUMER_LOG.isDebugEnabled() )
             {
-                NDC.pop();
-                NDC.push( "Pinger" );
+                MDC.put( "Replica", "Pinger" );
                 
                 CONSUMER_LOG.debug( "Starting the provider's pinger" );
             }

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=1417899&r1=1417898&r2=1417899&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
Thu Dec  6 14:19:38 2012
@@ -89,9 +89,9 @@ 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;
+import org.slf4j.MDC;
 
 
 /**
@@ -272,7 +272,6 @@ public class ReplicationConsumerImpl imp
      */
     private void prepareSyncSearchRequest() throws LdapException
     {
-        NDC.pop();
         String baseDn = config.getBaseDn();
 
         searchRequest = new SearchRequestImpl();
@@ -296,7 +295,7 @@ public class ReplicationConsumerImpl imp
         
         if ( CONSUMER_LOG.isDebugEnabled() )
         {
-            NDC.push( Integer.toString( config.getReplicaId() ) );
+            MDC.put( "Replica", Integer.toString( config.getReplicaId() ) );
             CONSUMER_LOG.debug( "Configuring consumer {}", config );
         }
     }
@@ -533,8 +532,7 @@ public class ReplicationConsumerImpl imp
     {
         if ( CONSUMER_LOG.isDebugEnabled() )
         {
-            NDC.pop();
-            NDC.push( Integer.toString( config.getReplicaId() ) );
+            MDC.put( "Replica", Integer.toString( config.getReplicaId() ) );
             CONSUMER_LOG.debug( "Consumer {} session with {} has been closed ", config.getReplicaId(),
config.getProducer() );
         }
         
@@ -881,8 +879,7 @@ public class ReplicationConsumerImpl imp
                 
                 if ( CONSUMER_LOG.isDebugEnabled() )
                 {
-                    NDC.pop();
-                    NDC.push( Integer.toString( config.getReplicaId() ) );
+                    MDC.put( "Replica", Integer.toString( config.getReplicaId() ) );
                     CONSUMER_LOG.info( "Unbound from the server {}", config.getProducer()
);
                 }
     

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=1417899&r1=1417898&r2=1417899&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties (original)
+++ directory/apacheds/trunk/server-integ/src/test/resources/log4j.properties Thu Dec  6 14:19:38
2012
@@ -18,8 +18,8 @@ log4j.rootCategory=OFF, stdout, file
 
 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.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] %C{1}.%M@%L - %m%n
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c-%X{Replica}] - %m%n
+#log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c-%X{Replica}] %C{1}.%M@%L
- %m%n
 
 log4j.appender.file=org.apache.log4j.RollingFileAppender
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
@@ -50,4 +50,4 @@ log4j.logger.org.apache.directory.server
 log4j.logger.org.apache.directory.ldap.client.api=FATAL
 log4j.logger.org.apache.directory.server.ldap.replication.provider=FATAL
 log4j.logger.PROVIDER_LOG=FATAL
-log4j.logger.CONSUMER_LOG=FATAL
\ No newline at end of file
+log4j.logger.CONSUMER_LOG=DATAL
\ No newline at end of file



Mime
View raw message