james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1075975 [2/3] - in /james/server/trunk: ./ container-spring/ container-spring/src/main/java/org/apache/james/container/spring/ container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/ container-spr...
Date Tue, 01 Mar 2011 18:48:31 GMT
Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java Tue Mar  1 18:48:27 2011
@@ -27,7 +27,6 @@ import javax.annotation.Resource;
 import javax.management.NotCompliantMBeanException;
 import javax.management.StandardMBean;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailbox.MailboxException;
 import org.apache.james.mailbox.MailboxManager;
@@ -35,6 +34,7 @@ import org.apache.james.mailbox.MailboxM
 import org.apache.james.mailbox.MailboxPath;
 import org.apache.james.mailbox.MailboxQuery;
 import org.apache.james.mailbox.MailboxSession;
+import org.slf4j.Logger;
 
 /**
  * JMX managmenent for Mailboxes
@@ -44,7 +44,7 @@ import org.apache.james.mailbox.MailboxS
 public class MailboxManagerManagement extends StandardMBean implements MailboxManagerManagementMBean, LogEnabled {
 
     private MailboxManager mailboxManager;
-    private Log log;
+    private Logger log;
     
     @Resource(name="mailboxmanager")
     public void setMailboxManager(MailboxManager mailboxManager) {
@@ -87,9 +87,9 @@ public class MailboxManagerManagement ex
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.log = log;
     }
 

Modified: james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java (original)
+++ james/server/trunk/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java Tue Mar  1 18:48:27 2011
@@ -21,11 +21,11 @@ package org.apache.james.adapter.mailbox
 
 import javax.annotation.Resource;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
+import org.slf4j.Logger;
 
 /**
  * Authenticator which use an UsersRepository to check if the user and password match
@@ -34,7 +34,7 @@ import org.apache.james.user.api.UsersRe
 public class UserRepositoryAuthenticator implements Authenticator, LogEnabled{
 
     private UsersRepository repos;
-    private Log log;
+    private Logger log;
 
     @Resource(name="usersrepository")
     public void setUsersRepository(UsersRepository repos) {
@@ -54,7 +54,7 @@ public class UserRepositoryAuthenticator
         return false;
     }
 
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.log = log;
     }
     

Modified: james/server/trunk/mailetcontainer-camel/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/pom.xml (original)
+++ james/server/trunk/mailetcontainer-camel/pom.xml Tue Mar  1 18:48:27 2011
@@ -63,8 +63,13 @@
     </dependency>
      -->  
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency> 
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
     </dependency> 
     <dependency>
       <groupId>commons-configuration</groupId>

Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessor.java Tue Mar  1 18:48:27 2011
@@ -32,7 +32,6 @@ import org.apache.camel.ProducerTemplate
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
-import org.apache.commons.logging.Log;
 import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.MatcherMailetPair;
@@ -40,6 +39,7 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
 import org.apache.mailet.Matcher;
+import org.slf4j.Logger;
 
 
 /**
@@ -146,7 +146,7 @@ public class CamelMailetProcessor extend
             Processor stateChangedProcessor = new StateChangedProcessor();
             
             String state = getState();
-            Log logger = getLogger();
+            Logger logger = getLogger();
 
             RouteDefinition processorDef = from(getEndpoint()).routeId(state).inOnly()
             // store the logger in properties

Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/CamelProcessor.java Tue Mar  1 18:48:27 2011
@@ -25,13 +25,13 @@ import javax.mail.MessagingException;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.commons.logging.Log;
 import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.MailetConfigImpl;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
+import org.slf4j.Logger;
 
 /**
  * Mailet wrapper which execute a Mailet in a Processor
@@ -40,7 +40,7 @@ import org.apache.mailet.MailetConfig;
 public class CamelProcessor implements Processor{
 
     private Mailet mailet;
-    private Log logger;
+    private Logger logger;
     private CamelMailetProcessor processor;
     
     /**
@@ -48,7 +48,7 @@ public class CamelProcessor implements P
      * 
      * @param mailet
      */
-    public CamelProcessor(Mailet mailet, Log logger, CamelMailetProcessor processor) {
+    public CamelProcessor(Mailet mailet, Logger logger, CamelMailetProcessor processor) {
         this.mailet = mailet;
         this.logger = logger;
         this.processor = processor;

Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/JamesMailetContext.java Tue Mar  1 18:48:27 2011
@@ -41,7 +41,6 @@ import javax.mail.internet.ParseExceptio
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.TemporaryResolutionException;
@@ -58,6 +57,7 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.RFC2822Headers;
+import org.slf4j.Logger;
 
 public abstract class JamesMailetContext implements MailetContext, LogEnabled, Configurable {
 
@@ -67,7 +67,7 @@ public abstract class JamesMailetContext
     private Hashtable<String, Object> attributes = new Hashtable<String, Object>();
     protected DNSService dns;
 
-    protected Log log;
+    protected Logger log;
 
     private UsersRepository localusers;
 
@@ -438,9 +438,9 @@ public abstract class JamesMailetContext
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.log = log;
     }
 

Modified: james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/camel/MatcherSplitter.java Tue Mar  1 18:48:27 2011
@@ -31,13 +31,13 @@ import org.apache.camel.Body;
 import org.apache.camel.Handler;
 import org.apache.camel.InOnly;
 import org.apache.camel.Property;
-import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
 import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor.MailetProcessorListener;
 import org.apache.james.mailetcontainer.lib.ProcessorUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
+import org.slf4j.Logger;
 
 /**
  * A Splitter for use with Camel to split the MailMessage into many pieces if needed. This is done
@@ -77,7 +77,7 @@ public class MatcherSplitter {
      */
     @SuppressWarnings("unchecked")
     @Handler
-    public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY) String onMatchException, @Property(LOGGER_PROPERTY) Log logger, @Property(MAILETCONTAINER_PROPERTY) CamelMailetProcessor container,
+    public List<Mail> split(@Property(MATCHER_PROPERTY) Matcher matcher, @Property(ON_MATCH_EXCEPTION_PROPERTY) String onMatchException, @Property(LOGGER_PROPERTY) Logger logger, @Property(MAILETCONTAINER_PROPERTY) CamelMailetProcessor container,
             @Body Mail mail) throws MessagingException {
         Collection<MailAddress> matchedRcpts = null;
         Collection<MailAddress> origRcpts = new ArrayList<MailAddress>(mail.getRecipients());

Modified: james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessorTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessorTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessorTest.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelCompositeProcessorTest.java Tue Mar  1 18:48:27 2011
@@ -21,12 +21,12 @@ package org.apache.james.mailetcontainer
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.mailetcontainer.api.mock.MockMailetContext;
 import org.apache.james.mailetcontainer.api.mock.MockMailetLoader;
 import org.apache.james.mailetcontainer.api.mock.MockMatcherLoader;
 import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessorTest;
 import org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor;
+import org.slf4j.LoggerFactory;
 
 public class CamelCompositeProcessorTest extends AbstractStateCompositeProcessorTest{
 
@@ -34,7 +34,7 @@ public class CamelCompositeProcessorTest
     protected AbstractStateCompositeProcessor createProcessor(HierarchicalConfiguration config) throws ConfigurationException, Exception {
         CamelCompositeProcessor processor = new CamelCompositeProcessor();
         try {
-            processor.setLog(new SimpleLog("MockLog"));
+            processor.setLog(LoggerFactory.getLogger("MockLog"));
             processor.setCamelContext(new DefaultCamelContext());
             processor.setMailetLoader(new MockMailetLoader());
             processor.setMatcherLoader(new MockMatcherLoader());

Modified: james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessorTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessorTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessorTest.java (original)
+++ james/server/trunk/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/camel/CamelMailetProcessorTest.java Tue Mar  1 18:48:27 2011
@@ -22,12 +22,13 @@ package org.apache.james.mailetcontainer
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.mailetcontainer.api.mock.MockMailetContext;
 import org.apache.james.mailetcontainer.api.mock.MockMailetLoader;
 import org.apache.james.mailetcontainer.api.mock.MockMatcherLoader;
 import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor;
 import org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessorTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CamelMailetProcessorTest extends AbstractStateMailetProcessorTest {
 
@@ -36,8 +37,9 @@ public class CamelMailetProcessorTest ex
         CamelMailetProcessor processor = null;
         try {
             processor = new CamelMailetProcessor();
-            SimpleLog log = new SimpleLog("MockLog");
-            log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+            Logger log = LoggerFactory.getLogger("MockLog");
+            // slf4j can't set programmatically any log level. It's just a facade
+            //log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
             processor.setLog(log);
             processor.setCamelContext(new DefaultCamelContext());
             processor.setMailetContext(new MockMailetContext());

Modified: james/server/trunk/mailetcontainer-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/pom.xml (original)
+++ james/server/trunk/mailetcontainer-library/pom.xml Tue Mar  1 18:48:27 2011
@@ -45,8 +45,8 @@
       <artifactId>apache-mailet-base</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency> 
     <dependency>
       <groupId>commons-configuration</groupId>

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessor.java Tue Mar  1 18:48:27 2011
@@ -31,13 +31,13 @@ import javax.mail.MessagingException;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.lib.jmx.JMXStateCompositeProcessorListener;
 import org.apache.mailet.Mail;
+import org.slf4j.Logger;
 
 /**
  * Abstract base class for {@link CompositeProcessor} which service the {@link Mail} with a {@link CamelProcessor} instances
@@ -48,7 +48,7 @@ public abstract class AbstractStateCompo
 
     private List<CompositeProcessorListener> listeners = Collections.synchronizedList(new ArrayList<CompositeProcessorListener>());
     private final Map<String,MailProcessor> processors = new HashMap<String,MailProcessor>();
-    protected Log logger;
+    protected Logger logger;
     protected HierarchicalConfiguration config;
 
     private JMXStateCompositeProcessorListener jmxListener;
@@ -56,9 +56,9 @@ public abstract class AbstractStateCompo
     
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.logger = log;
 
     }

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessor.java Tue Mar  1 18:48:27 2011
@@ -33,7 +33,6 @@ import javax.management.NotCompliantMBea
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailetcontainer.api.MailProcessor;
@@ -50,6 +49,7 @@ import org.apache.mailet.Matcher;
 import org.apache.mailet.MatcherConfig;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.MatcherInverter;
+import org.slf4j.Logger;
 
 /**
  * Abstract base class for {@link MailProcessor} implementations which want to process {@link Mail} via {@link Matcher} and {@link Mailet}
@@ -62,7 +62,7 @@ public abstract class AbstractStateMaile
     private List<MailetProcessorListener> listeners = Collections.synchronizedList(new ArrayList<MailetProcessorListener>());
     private JMXStateMailetProcessorListener jmxListener;
     private boolean enableJmx = true;
-    private Log logger;
+    private Logger logger;
     private HierarchicalConfiguration config;
     private MailetLoader mailetLoader;
     private List<MatcherMailetPair> pairs = new ArrayList<MatcherMailetPair>();
@@ -86,9 +86,9 @@ public abstract class AbstractStateMaile
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.api.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.api.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.logger = log;
     }
 
@@ -163,7 +163,7 @@ public abstract class AbstractStateMaile
         mailetContext.sendMail(mail);
     }
     
-    protected Log getLogger() {
+    protected Logger getLogger() {
         return logger;
     }
     

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/JamesMailSpooler.java Tue Mar  1 18:48:27 2011
@@ -31,7 +31,6 @@ import javax.annotation.Resource;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
@@ -41,6 +40,7 @@ import org.apache.james.queue.api.MailQu
 import org.apache.james.queue.api.MailQueue.MailQueueItem;
 import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.mailet.Mail;
+import org.slf4j.Logger;
 
 /**
  * Manages the mail spool.  This class is responsible for retrieving
@@ -86,7 +86,7 @@ public class JamesMailSpooler implements
      */
     private MailProcessor mailProcessor;
 
-    private Log logger;
+    private Logger logger;
 
     private MailQueueFactory queueFactory;
 
@@ -229,9 +229,9 @@ public class JamesMailSpooler implements
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.logger = log;
     }
 

Modified: james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java (original)
+++ james/server/trunk/mailetcontainer-library/src/main/java/org/apache/james/mailetcontainer/lib/ProcessorUtil.java Tue Mar  1 18:48:27 2011
@@ -26,10 +26,10 @@ import java.util.Collection;
 
 import javax.mail.MessagingException;
 
-import org.apache.commons.logging.Log;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetException;
+import org.slf4j.Logger;
 
 public class ProcessorUtil {
 
@@ -44,7 +44,7 @@ public class ProcessorUtil {
      *
      * @throws MessagingException thrown always, rethrowing the passed in exception
      */
-    public static void handleException(MessagingException me, Mail mail, String offendersName, String nextState, Log logger) throws MessagingException {
+    public static void handleException(MessagingException me, Mail mail, String offendersName, String nextState, Logger logger) throws MessagingException {
         mail.setState(nextState);
         StringWriter sout = new StringWriter();
         PrintWriter out = new PrintWriter(sout, true);

Modified: james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java (original)
+++ james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java Tue Mar  1 18:48:27 2011
@@ -29,11 +29,12 @@ import junit.framework.TestCase;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.core.MailImpl;
 import org.apache.james.mailetcontainer.api.MailProcessor;
 import org.apache.james.mailetcontainer.api.mock.MockMailProcessor;
 import org.apache.mailet.Mail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public abstract class AbstractStateCompositeProcessorTest extends TestCase{
 
@@ -55,8 +56,9 @@ public abstract class AbstractStateCompo
                 };
             }
         };
-        SimpleLog log = new SimpleLog("MockLog");
-        log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+        Logger log = LoggerFactory.getLogger("MockLog");
+        // slf4j can't set programmatically any log level. It's just a facade
+        // log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         processor.setLog(log);
         processor.configure(createConfig(Arrays.asList("root","error","test")));
         processor.init();

Modified: james/server/trunk/mailets/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailets/pom.xml (original)
+++ james/server/trunk/mailets/pom.xml Tue Mar  1 18:48:27 2011
@@ -162,8 +162,8 @@
       <artifactId>commons-configuration</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>

Modified: james/server/trunk/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java (original)
+++ james/server/trunk/mailets/src/main/java/org/apache/james/transport/util/MailetContextLog.java Tue Mar  1 18:48:27 2011
@@ -18,15 +18,17 @@
  ****************************************************************/
 package org.apache.james.transport.util;
 
-import org.apache.commons.logging.Log;
 import org.apache.mailet.MailetContext;
+import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 /**
- * {@link Log} implementation which delegate the logging to a {@link MailetContext}
+ * {@link Logger} implementation which delegate the logging to a
+ * {@link MailetContext}
+ * 
  * 
- *
  */
-public class MailetContextLog implements Log {
+public class MailetContextLog implements Logger {
 
     private boolean isDebug;
     private MailetContext context;
@@ -35,83 +37,68 @@ public class MailetContextLog implements
         this.context = context;
         this.isDebug = isDebug;
     }
-    
+
     public MailetContextLog(MailetContext context) {
         this(context, false);
-        
+
     }
-    
 
     /**
      * Only log if {@link #isDebugEnabled()} is true
      */
-    public void debug(Object arg0) {
+    public void debug(String arg0) {
         if (isDebug) {
-            context.log(arg0.toString());
+            debugLog(arg0);
         }
     }
 
     /**
      * Only log if {@link #isDebugEnabled()} is true
      */
-    public void debug(Object arg0, Throwable arg1) {
+    public void debug(String arg0, Throwable arg1) {
         if (isDebug) {
-            context.log(arg0.toString(), arg1);
-        }            
+            debugLog(arg0, arg1);
+        }
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#error(java.lang.Object)
+     * 
+     * @see org.slf4j.Logger#error(java.lang.String)
      */
-    public void error(Object arg0) {
-        context.log(arg0.toString());
-        
-    }
+    public void error(String arg0) {
+        errorLog(arg0);
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#error(java.lang.Object, java.lang.Throwable)
-     */
-    public void error(Object arg0, Throwable arg1) {
-        context.log(arg0.toString(), arg1);
-        
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#fatal(java.lang.Object)
+     * 
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Throwable)
      */
-    public void fatal(Object arg0) {
-        context.log(arg0.toString());
-        
-    }
+    public void error(String arg0, Throwable arg1) {
+        errorLog(arg0, arg1);
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#fatal(java.lang.Object, java.lang.Throwable)
-     */
-    public void fatal(Object arg0, Throwable arg1) {
-        context.log(arg0.toString(), arg1);
-        
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#info(java.lang.Object)
+     * 
+     * @see org.slf4j.Logger#info(java.lang.String)
      */
-    public void info(Object arg0) {
-        context.log(arg0.toString());
-        
+    public void info(String arg0) {
+        infoLog(arg0);
+
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#info(java.lang.Object, java.lang.Throwable)
+     * 
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Throwable)
      */
-    public void info(Object arg0, Throwable arg1) {
-        context.log(arg0.toString(), arg1);
-        
+    public void info(String arg0, Throwable arg1) {
+        infoLog(arg0, arg1);
+
     }
 
     /**
@@ -160,32 +147,722 @@ public class MailetContextLog implements
     /**
      * Do nothing
      */
-    public void trace(Object arg0) {            
+    public void trace(Object arg0) {
     }
 
     /**
      * Do nothing
      */
     public void trace(Object arg0, Throwable arg1) {
-        
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(java.lang.String)
+     */
+    public void warn(String arg0) {
+        warnLog(arg0);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Throwable)
+     */
+    public void warn(String arg0, Throwable arg1) {
+        warnLog(arg0, arg1);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#getName()
+     */
+    public String getName() {
+        return context.toString();
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(String msg) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(String format, Object arg) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(String format, Object arg1, Object arg2) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(String format, Object[] argArray) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(String msg, Throwable t) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public boolean isTraceEnabled(Marker marker) {
+        return false;
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(Marker marker, String msg) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(Marker marker, String format, Object arg) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(Marker marker, String format, Object arg1, Object arg2) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(Marker marker, String format, Object[] argArray) {
+    }
+
+    /**
+     * Do nothing
+     */
+    public void trace(Marker marker, String msg, Throwable t) {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object)
+     */
+    public void debug(String format, Object arg) {
+        if (isDebug) {
+            debugLog(format, arg);
+        }
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#warn(java.lang.Object)
+     * 
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object,
+     * java.lang.Object)
      */
-    public void warn(Object arg0) {
-        context.log(arg0.toString());
-        
+    public void debug(String format, Object arg1, Object arg2) {
+        if (isDebug) {
+            debugLog(format, arg1, arg2);
+        }
     }
 
     /*
      * (non-Javadoc)
-     * @see org.apache.commons.logging.Log#warn(java.lang.Object, java.lang.Throwable)
+     * 
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object[])
      */
-    public void warn(Object arg0, Throwable arg1) {
-        context.log(arg0.toString(), arg1);
-        
+    public void debug(String format, Object[] argArray) {
+        if (isDebug) {
+            debugLog(format, argArray);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#isDebugEnabled(org.slf4j.Marker)
+     */
+    public boolean isDebugEnabled(Marker marker) {
+        return isDebug;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String)
+     */
+    public void debug(Marker marker, String msg) {
+        if (isDebug) {
+            debugLog(marker, msg);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object)
+     */
+    public void debug(Marker marker, String format, Object arg) {
+        if (isDebug) {
+            debugLog(marker, format, arg);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object, java.lang.Object)
+     */
+    public void debug(Marker marker, String format, Object arg1, Object arg2) {
+        if (isDebug) {
+            debugLog(marker, format, arg1, arg2);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object[])
+     */
+    public void debug(Marker marker, String format, Object[] argArray) {
+        if (isDebug) {
+            debugLog(marker, format, argArray);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#debug(org.slf4j.Marker, java.lang.String,
+     * java.lang.Throwable)
+     */
+    public void debug(Marker marker, String msg, Throwable t) {
+        if (isDebug) {
+            debugLog(marker, msg, t);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object)
+     */
+    public void info(String format, Object arg) {
+        infoLog(format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object,
+     * java.lang.Object)
+     */
+    public void info(String format, Object arg1, Object arg2) {
+        infoLog(format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object[])
+     */
+    public void info(String format, Object[] argArray) {
+        infoLog(format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#isInfoEnabled(org.slf4j.Marker)
+     */
+    public boolean isInfoEnabled(Marker marker) {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String)
+     */
+    public void info(Marker marker, String msg) {
+        infoLog(marker, msg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object)
+     */
+    public void info(Marker marker, String format, Object arg) {
+        infoLog(marker, format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object, java.lang.Object)
+     */
+    public void info(Marker marker, String format, Object arg1, Object arg2) {
+        infoLog(marker, format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object[])
+     */
+    public void info(Marker marker, String format, Object[] argArray) {
+        infoLog(marker, format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#info(org.slf4j.Marker, java.lang.String,
+     * java.lang.Throwable)
+     */
+    public void info(Marker marker, String msg, Throwable t) {
+        infoLog(marker, msg, t);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object)
+     */
+    public void warn(String format, Object arg) {
+        warnLog(format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object[])
+     */
+    public void warn(String format, Object[] argArray) {
+        warnLog(format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object,
+     * java.lang.Object)
+     */
+    public void warn(String format, Object arg1, Object arg2) {
+        warnLog(format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#isWarnEnabled(org.slf4j.Marker)
+     */
+    public boolean isWarnEnabled(Marker marker) {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String)
+     */
+    public void warn(Marker marker, String msg) {
+        warnLog(marker, msg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object)
+     */
+    public void warn(Marker marker, String format, Object arg) {
+        warnLog(marker, format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object, java.lang.Object)
+     */
+    public void warn(Marker marker, String format, Object arg1, Object arg2) {
+        warnLog(marker, format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object[])
+     */
+    public void warn(Marker marker, String format, Object[] argArray) {
+        warnLog(marker, format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#warn(org.slf4j.Marker, java.lang.String,
+     * java.lang.Throwable)
+     */
+    public void warn(Marker marker, String msg, Throwable t) {
+        warnLog(marker, msg, t);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object)
+     */
+    public void error(String format, Object arg) {
+        errorLog(format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object,
+     * java.lang.Object)
+     */
+    public void error(String format, Object arg1, Object arg2) {
+        errorLog(format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object[])
+     */
+    public void error(String format, Object[] argArray) {
+        errorLog(format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#isErrorEnabled(org.slf4j.Marker)
+     */
+    public boolean isErrorEnabled(Marker marker) {
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String)
+     */
+    public void error(Marker marker, String msg) {
+        errorLog(marker, msg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object)
+     */
+    public void error(Marker marker, String format, Object arg) {
+        errorLog(marker, format, arg);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object, java.lang.Object)
+     */
+    public void error(Marker marker, String format, Object arg1, Object arg2) {
+        errorLog(marker, format, arg1, arg2);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String,
+     * java.lang.Object[])
+     */
+    public void error(Marker marker, String format, Object[] argArray) {
+        errorLog(marker, format, argArray);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.slf4j.Logger#error(org.slf4j.Marker, java.lang.String,
+     * java.lang.Throwable)
+     */
+    public void error(Marker marker, String msg, Throwable t) {
+        errorLog(marker, msg, t);
+    }
+
+    private void debugLog(Marker marker, String msg, Object... obj) {
+        StringBuffer s = new StringBuffer("[");
+        s.append(marker.toString()).append("] ").append(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.DEBUG, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void debugLog(String msg, Object... obj) {
+        StringBuffer s = new StringBuffer(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.DEBUG, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.DEBUG, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void errorLog(Marker marker, String msg, Object... obj) {
+        StringBuffer s = new StringBuffer("[");
+        s.append(marker.toString()).append("] ").append(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.ERROR, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void errorLog(String msg, Object... obj) {
+        StringBuffer s = new StringBuffer(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.ERROR, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.ERROR, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void infoLog(Marker marker, String msg, Object... obj) {
+        StringBuffer s = new StringBuffer("[");
+        s.append(marker.toString()).append("] ").append(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.INFO, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.INFO, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void infoLog(String msg, Object... obj) {
+        StringBuffer s = new StringBuffer(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.INFO, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.INFO, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void warnLog(Marker marker, String msg, Object... obj) {
+        StringBuffer s = new StringBuffer("[");
+        s.append(marker.toString()).append("] ").append(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.WARN, s.toString(), t);
+            context.log(s.toString(), t);
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.WARN, s.toString());
+            context.log(s.toString());
+        }
+    }
+
+    private void warnLog(String msg, Object... obj) {
+        StringBuffer s = new StringBuffer(msg);
+        Throwable t = null;
+        if (obj != null) {
+            s.append(" args=[");
+            boolean first = true;
+            for (Object o : obj) {
+                if (o instanceof Throwable) {
+                    t = (Throwable) o;
+                } else {
+                    if (first) {
+                        s.append(o.toString());
+                        first = false;
+                    } else {
+                        s.append(", ").append(o.toString());
+                    }
+                }
+            }
+            s.append("]");
+        }
+        if (t != null) {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.WARN, s.toString(), t);
+            context.log(s.toString(), t);
+            t.printStackTrace();
+        } else {
+            // TODO Use with apache-mailet-2.5
+            // context.log(MailetContext.LogLevel.WARN, s.toString());
+            context.log(s.toString());
+        }
     }
-    
 }

Modified: james/server/trunk/osgi/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/osgi/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/osgi/pom.xml (original)
+++ james/server/trunk/osgi/pom.xml Tue Mar  1 18:48:27 2011
@@ -96,8 +96,8 @@
       <artifactId>commons-configuration</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
   </dependencies>
 </project>

Modified: james/server/trunk/osgi/src/main/java/org/apache/james/container/osgi/OsgiLogProvider.java
URL: http://svn.apache.org/viewvc/james/server/trunk/osgi/src/main/java/org/apache/james/container/osgi/OsgiLogProvider.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/osgi/src/main/java/org/apache/james/container/osgi/OsgiLogProvider.java (original)
+++ james/server/trunk/osgi/src/main/java/org/apache/james/container/osgi/OsgiLogProvider.java Tue Mar  1 18:48:27 2011
@@ -18,9 +18,9 @@
  ****************************************************************/
 package org.apache.james.container.osgi;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.james.container.spring.provider.log.LogProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -33,11 +33,11 @@ public class OsgiLogProvider implements 
      * (non-Javadoc)
      * @see org.apache.james.container.spring.lifecycle.LogProvider#getLog(java.lang.String)
      */
-    public Log getLog(String beanName) {
-        return LogFactory.getLog(beanName);
+    public Logger getLog(String beanName) {
+        return LoggerFactory.getLogger(beanName);
     }
 
-    public void registerLog(String beanName, Log log) {
+    public void registerLog(String beanName, Logger log) {
         // TODO Auto-generated method stub
         
     }

Modified: james/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/pom.xml (original)
+++ james/server/trunk/pom.xml Tue Mar  1 18:48:27 2011
@@ -775,27 +775,25 @@
       <version>3.2.1</version>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>${commons.logging.version}</version>
-      <exclusions>
-        <exclusion>
-          <artifactId>logkit</artifactId>
-          <groupId>logkit</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>avalon-framework</artifactId>
-          <groupId>avalon-framework</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>log4j</artifactId>
-          <groupId>log4j</groupId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>servlet-api</artifactId>
-        </exclusion>
-      </exclusions>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>1.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>1.6.1</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-lang</groupId>
@@ -921,7 +919,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>1.2.14</version>
+      <version>1.2.16</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
@@ -997,19 +995,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>1.5.8</version>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.5.8</version>
-      <scope>runtime</scope>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.openjpa</groupId>
       <artifactId>openjpa</artifactId>
       <version>2.0.1</version>
@@ -1233,10 +1218,9 @@
     <spring.version>3.0.5.RELEASE</spring.version>
     <mailbox.version>0.2-M2-SNAPSHOT</mailbox.version>
     <imap.version>0.2-M2-SNAPSHOT</imap.version>
-    <protocols.version>1.3</protocols.version>
+    <protocols.version>1.4-SNAPSHOT</protocols.version>
     <jsieve.version>0.4</jsieve.version>
     <jackrabbit.version>2.2.2</jackrabbit.version>
-    <commons.logging.version>1.1.1</commons.logging.version>
     
     <!-- For more details see -->
     <!-- http://java.sun.com/products/javamail/javadocs/javax/mail/internet/package-summary.html -->

Modified: james/server/trunk/pop3server/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/pop3server/pom.xml (original)
+++ james/server/trunk/pop3server/pom.xml Tue Mar  1 18:48:27 2011
@@ -57,8 +57,8 @@
       <artifactId>apache-james-mailbox-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency> 
     <dependency>
       <groupId>commons-configuration</groupId>

Modified: james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3ChannelUpstreamHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3ChannelUpstreamHandler.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3ChannelUpstreamHandler.java (original)
+++ james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3ChannelUpstreamHandler.java Tue Mar  1 18:48:27 2011
@@ -21,13 +21,13 @@ package org.apache.james.pop3server.nett
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.pop3server.POP3HandlerConfigurationData;
 import org.apache.james.protocols.api.ProtocolHandlerChain;
 import org.apache.james.protocols.api.ProtocolSession;
 import org.apache.james.protocols.impl.AbstractChannelUpstreamHandler;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.ChannelUpstreamHandler;
+import org.slf4j.Logger;
 
 /**
  * {@link ChannelUpstreamHandler} which is used for the POP3 Server
@@ -36,12 +36,12 @@ import org.jboss.netty.channel.ChannelUp
  */
 public class POP3ChannelUpstreamHandler extends AbstractChannelUpstreamHandler{
 
-    private final Log logger;
+    private final Logger logger;
     private final POP3HandlerConfigurationData conf;
     private final  SSLContext context;
     private String[] enabledCipherSuites;
     
-    public POP3ChannelUpstreamHandler(ProtocolHandlerChain chain, POP3HandlerConfigurationData conf, Log logger, SSLContext context, String[] enabledCipherSuites) {
+    public POP3ChannelUpstreamHandler(ProtocolHandlerChain chain, POP3HandlerConfigurationData conf, Logger logger, SSLContext context, String[] enabledCipherSuites) {
         super(chain);
         this.logger = logger;
         this.conf = conf;
@@ -49,7 +49,7 @@ public class POP3ChannelUpstreamHandler 
         this.enabledCipherSuites = enabledCipherSuites;
     }
 
-    public POP3ChannelUpstreamHandler(ProtocolHandlerChain chain, POP3HandlerConfigurationData conf, Log logger) {
+    public POP3ChannelUpstreamHandler(ProtocolHandlerChain chain, POP3HandlerConfigurationData conf, Logger logger) {
         this(chain, conf, logger, null, null);
     }
 

Modified: james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java (original)
+++ james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java Tue Mar  1 18:48:27 2011
@@ -23,12 +23,12 @@ import java.util.Map;
 
 import javax.net.ssl.SSLEngine;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.pop3server.POP3HandlerConfigurationData;
 import org.apache.james.pop3server.POP3Session;
 import org.apache.james.protocols.impl.AbstractSession;
 import org.jboss.netty.channel.ChannelHandlerContext;
+import org.slf4j.Logger;
 
 /**
  * {@link POP3Session} implementation which use Netty
@@ -44,12 +44,12 @@ public class POP3NettySession extends Ab
     private MessageManager mailbox;
 
 
-    public POP3NettySession(POP3HandlerConfigurationData configData, Log logger, ChannelHandlerContext handlerContext) {
+    public POP3NettySession(POP3HandlerConfigurationData configData, Logger logger, ChannelHandlerContext handlerContext) {
         this(configData, logger, handlerContext, null);
     }
 
 
-    public POP3NettySession(POP3HandlerConfigurationData configData, Log logger, ChannelHandlerContext handlerContext, SSLEngine engine) {
+    public POP3NettySession(POP3HandlerConfigurationData configData, Logger logger, ChannelHandlerContext handlerContext, SSLEngine engine) {
         super(logger, handlerContext, engine);
         this.configData = configData;
     }

Modified: james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java (original)
+++ james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java Tue Mar  1 18:48:27 2011
@@ -32,7 +32,6 @@ import javax.mail.Flags;
 
 import junit.framework.TestCase;
 
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.commons.net.pop3.POP3Client;
 import org.apache.commons.net.pop3.POP3MessageInfo;
 import org.apache.commons.net.pop3.POP3Reply;
@@ -55,6 +54,8 @@ import org.apache.james.protocols.lib.mo
 import org.apache.james.protocols.lib.mock.MockProtocolHandlerChain;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.lib.mock.MockUsersRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class POP3ServerTest extends TestCase {
 
@@ -93,8 +94,9 @@ public class POP3ServerTest extends Test
         m_pop3Server.setProtocolHandlerChain(chain);
        
         
-        SimpleLog log = new SimpleLog("Mock");
-        log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+        Logger log = LoggerFactory.getLogger("Mock");
+        // slf4j can't set programmatically any log level. It's just a facade
+        // log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         m_pop3Server.setLog(log);
     }
 
@@ -104,7 +106,7 @@ public class POP3ServerTest extends Test
         
         chain = new MockProtocolHandlerChain();
         chain.setLoader(serviceManager);
-        chain.setLog(new SimpleLog("ChainLog"));
+        chain.setLog(LoggerFactory.getLogger("ChainLog"));
    
         setUpPOP3Server();
         m_testConfiguration = new POP3TestConfiguration(m_pop3ListenerPort);
@@ -281,7 +283,7 @@ public class POP3ServerTest extends Test
 
         m_pop3Protocol.disconnect();
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo", "INBOX");
-        MailboxSession session = manager.login("foo", "bar", new SimpleLog("Test"));
+        MailboxSession session = manager.login("foo", "bar", LoggerFactory.getLogger("Test"));
         if (manager.mailboxExists(mailboxPath, session) == false) {
             manager.createMailbox(mailboxPath, session);
         }
@@ -363,7 +365,7 @@ public class POP3ServerTest extends Test
         m_usersRepository.addUser("foo2", "bar2");
 
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2", "INBOX");
-        MailboxSession session = manager.login("foo2", "bar2", new SimpleLog("Test"));
+        MailboxSession session = manager.login("foo2", "bar2", LoggerFactory.getLogger("Test"));
         
         if (manager.mailboxExists(mailboxPath, session) == false) {
             manager.createMailbox(mailboxPath, session);
@@ -595,7 +597,7 @@ public class POP3ServerTest extends Test
         m_usersRepository.addUser("foo6", "bar6");
 
         MailboxPath mailboxPath = MailboxPath.inbox("foo6");
-        MailboxSession session = manager.login("foo6", "bar6", new SimpleLog("Test"));
+        MailboxSession session = manager.login("foo6", "bar6", LoggerFactory.getLogger("Test"));
         
         manager.startProcessingRequest(session);
         if (manager.mailboxExists(mailboxPath, session) == false) {

Modified: james/server/trunk/protocols-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/protocols-library/pom.xml (original)
+++ james/server/trunk/protocols-library/pom.xml Tue Mar  1 18:48:27 2011
@@ -95,8 +95,13 @@
       <artifactId>protocols-impl</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>commons-configuration</groupId>

Modified: james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java (original)
+++ james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java Tue Mar  1 18:48:27 2011
@@ -33,7 +33,6 @@ import javax.net.ssl.SSLContext;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.Configurable;
@@ -41,6 +40,7 @@ import org.apache.james.lifecycle.api.Lo
 import org.apache.james.protocols.impl.AbstractAsyncServer;
 import org.apache.james.protocols.lib.jmx.ServerMBean;
 import org.apache.james.util.concurrent.JMXEnabledThreadPoolExecutor;
+import org.slf4j.Logger;
 
 
 /**
@@ -82,7 +82,7 @@ public abstract class AbstractConfigurab
     
     private FileSystem fileSystem;
 
-    private Log logger;
+    private Logger logger;
 
     private DNSService dns;
 
@@ -121,9 +121,9 @@ public abstract class AbstractConfigurab
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public final void setLog(Log logger) {
+    public final void setLog(Logger logger) {
        this.logger = logger;
     }
 
@@ -135,7 +135,7 @@ public abstract class AbstractConfigurab
         
         enabled = config.getBoolean("[@enabled]", true);
         
-        final Log logger = getLogger();
+        final Logger logger = getLogger();
         if (!enabled) {
           logger.info(getServiceType() + " disabled by configuration");
           return;
@@ -348,7 +348,7 @@ public abstract class AbstractConfigurab
      * 
      * @return logger
      */
-    protected Log getLogger() {
+    protected Logger getLogger() {
         return logger;
     }
     

Modified: james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockJSR250Loader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockJSR250Loader.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockJSR250Loader.java (original)
+++ james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockJSR250Loader.java Tue Mar  1 18:48:27 2011
@@ -31,7 +31,7 @@ import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
 
 public class MockJSR250Loader {
 
@@ -65,7 +65,7 @@ public class MockJSR250Loader {
         return newInstance(clazz, null, null);
     }
 
-    public  final <T> T newInstance(Class<T> clazz, Log log, HierarchicalConfiguration config)  throws Exception{
+    public  final <T> T newInstance(Class<T> clazz, Logger log, HierarchicalConfiguration config)  throws Exception{
             T obj = clazz.newInstance();
             injectResources(obj);
             postConstruct(obj);

Modified: james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerChain.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerChain.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerChain.java (original)
+++ james/server/trunk/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerChain.java Tue Mar  1 18:48:27 2011
@@ -28,13 +28,13 @@ import javax.annotation.Resource;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.protocols.api.ExtensibleHandler;
 import org.apache.james.protocols.api.HandlersPackage;
 import org.apache.james.protocols.api.ProtocolHandlerChain;
 import org.apache.james.protocols.api.WiringException;
+import org.slf4j.Logger;
 
 
 /**
@@ -46,7 +46,7 @@ import org.apache.james.protocols.api.Wi
 @SuppressWarnings("unchecked")
 public class MockProtocolHandlerChain implements ProtocolHandlerChain, Configurable, LogEnabled {
   
-    private Log log;
+    private Logger log;
     private String coreHandlersPackage;
     private LinkedList handlers = new LinkedList();
     private HierarchicalConfiguration config;
@@ -211,9 +211,9 @@ public class MockProtocolHandlerChain im
     
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.log = log;
     }
 }
\ No newline at end of file

Modified: james/server/trunk/queue-activemq/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-activemq/pom.xml (original)
+++ james/server/trunk/queue-activemq/pom.xml Tue Mar  1 18:48:27 2011
@@ -92,8 +92,8 @@
       <artifactId>${javax.mail.artifactId}</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency> 
     
     <!-- testing -->
@@ -108,5 +108,10 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency> 
   </dependencies>
 </project>

Modified: james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java (original)
+++ james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java Tue Mar  1 18:48:27 2011
@@ -45,7 +45,6 @@ import org.apache.activemq.ActiveMQSessi
 import org.apache.activemq.BlobMessage;
 import org.apache.activemq.command.ActiveMQBlobMessage;
 import org.apache.activemq.util.JMSExceptionSupport;
-import org.apache.commons.logging.Log;
 import org.apache.james.core.MimeMessageCopyOnWriteProxy;
 import org.apache.james.core.MimeMessageInputStream;
 import org.apache.james.core.MimeMessageInputStreamSource;
@@ -54,6 +53,7 @@ import org.apache.james.core.MimeMessage
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.jms.JMSMailQueue;
 import org.apache.mailet.Mail;
+import org.slf4j.Logger;
 import org.springframework.jms.connection.SessionProxy;
 
 /**
@@ -94,7 +94,7 @@ public class ActiveMQMailQueue extends J
      * 
      * @see #ActiveMQMailQueue(ConnectionFactory, String, boolean, Log)
      */
-    public ActiveMQMailQueue(final ConnectionFactory connectionFactory, final String queuename, final Log logger) {
+    public ActiveMQMailQueue(final ConnectionFactory connectionFactory, final String queuename, final Logger logger) {
         this(connectionFactory, queuename, true, logger);
     }
     
@@ -110,7 +110,7 @@ public class ActiveMQMailQueue extends J
      * @param logger
      * @throws NotCompliantMBeanException 
      */
-    public ActiveMQMailQueue(final ConnectionFactory connectionFactory, final String queuename, boolean useBlob, final Log logger) {
+    public ActiveMQMailQueue(final ConnectionFactory connectionFactory, final String queuename, boolean useBlob, final Logger logger) {
         super(connectionFactory, queuename, logger);
         this.useBlob = useBlob;
     }

Modified: james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueItem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueItem.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueItem.java (original)
+++ james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueueItem.java Tue Mar  1 18:48:27 2011
@@ -28,11 +28,11 @@ import javax.jms.MessageConsumer;
 import javax.jms.Session;
 
 import org.apache.activemq.command.ActiveMQBlobMessage;
-import org.apache.commons.logging.Log;
 import org.apache.james.queue.api.MailQueue.MailQueueException;
 import org.apache.james.queue.api.MailQueue.MailQueueItem;
 import org.apache.james.queue.jms.JMSMailQueueItem;
 import org.apache.mailet.Mail;
+import org.slf4j.Logger;
 
 /**
  * ActiveMQ {@link MailQueueItem} implementation which handles Blob-Messages as
@@ -42,9 +42,9 @@ import org.apache.mailet.Mail;
 public class ActiveMQMailQueueItem extends JMSMailQueueItem implements ActiveMQSupport{
 
     private final Message message;
-    private final Log logger;
+    private final Logger logger;
 
-    public ActiveMQMailQueueItem(Mail mail, Connection connection, Session session, MessageConsumer consumer, Message message, Log logger) {
+    public ActiveMQMailQueueItem(Mail mail, Connection connection, Session session, MessageConsumer consumer, Message message, Logger logger) {
         super(mail, connection, session, consumer);
         this.message = message;
         this.logger = logger;

Modified: james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java (original)
+++ james/server/trunk/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQMailQueueTest.java Tue Mar  1 18:48:27 2011
@@ -26,6 +26,8 @@ import org.apache.activemq.plugin.Statis
 import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.queue.jms.JMSMailQueue;
 import org.apache.james.queue.jms.JMSMailQueueTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ActiveMQMailQueueTest extends JMSMailQueueTest{
 
@@ -43,8 +45,9 @@ public class ActiveMQMailQueueTest exten
 
     @Override
     protected JMSMailQueue createQueue(ConnectionFactory factory, String queueName) {
-        SimpleLog log = new SimpleLog("MockLog");
-        log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+        Logger log = LoggerFactory.getLogger("MockLog");
+        // slf4j can't set programmatically any log level. It's just a facade
+        // log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         ActiveMQMailQueue queue = new ActiveMQMailQueue(factory, queueName, useBlobMessages(),log);
         return queue;
     }

Modified: james/server/trunk/queue-jms/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-jms/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-jms/pom.xml (original)
+++ james/server/trunk/queue-jms/pom.xml Tue Mar  1 18:48:27 2011
@@ -46,8 +46,8 @@
       <artifactId>apache-mailet</artifactId>
     </dependency>   
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency> 
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
@@ -73,5 +73,10 @@
       <artifactId>activemq-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency> 
   </dependencies>
 </project>

Modified: james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java (original)
+++ james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java Tue Mar  1 18:48:27 2011
@@ -47,7 +47,6 @@ import javax.mail.MessagingException;
 import javax.mail.internet.AddressException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.core.MailImpl;
 import org.apache.james.core.MimeMessageCopyOnWriteProxy;
 import org.apache.james.queue.api.MailPrioritySupport;
@@ -55,6 +54,7 @@ import org.apache.james.queue.api.MailQu
 import org.apache.james.queue.api.ManageableMailQueue;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
+import org.slf4j.Logger;
 
 /**
  * {@link MailQueue} implementation which use a JMS Queue for the
@@ -69,11 +69,11 @@ public class JMSMailQueue implements Man
 
     protected final String queuename;
     protected final ConnectionFactory connectionFactory;
-    protected final Log logger;
+    protected final Logger logger;
     public final static String FORCE_DELIVERY = "FORCE_DELIVERY";
 
 
-    public JMSMailQueue(final ConnectionFactory connectionFactory, final String queuename, final Log logger) {
+    public JMSMailQueue(final ConnectionFactory connectionFactory, final String queuename, final Logger logger) {
         this.connectionFactory = connectionFactory;
         this.queuename = queuename;
         this.logger = logger;

Modified: james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java (original)
+++ james/server/trunk/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java Tue Mar  1 18:48:27 2011
@@ -30,7 +30,6 @@ import javax.annotation.PreDestroy;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.queue.api.MailQueue;
@@ -38,6 +37,7 @@ import org.apache.james.queue.api.MailQu
 import org.apache.james.queue.api.MailQueueManagementMBean;
 import org.apache.james.queue.api.ManageableMailQueue;
 import org.apache.james.queue.library.MailQueueManagement;
+import org.slf4j.Logger;
 
 /**
  * {@link MailQueueFactory} abstract base class which take care of register the {@link MailQueue} implementations via JMX (if possible)
@@ -49,7 +49,7 @@ public abstract class AbstractMailQueueF
     
     
     protected final Map<String, MailQueue> queues = new HashMap<String, MailQueue>();
-    protected Log log;
+    protected Logger log;
     private boolean useJMX = true;
     private MBeanServer mbeanServer;
     private List<String> mbeans = new ArrayList<String>();
@@ -136,9 +136,9 @@ public abstract class AbstractMailQueueF
     
     /*
      * (non-Javadoc)
-     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.apache.commons.logging.Log)
+     * @see org.apache.james.lifecycle.LogEnabled#setLog(org.slf4j.Logger)
      */
-    public void setLog(Log log) {
+    public void setLog(Logger log) {
         this.log = log;
     }
 }
\ No newline at end of file

Modified: james/server/trunk/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java (original)
+++ james/server/trunk/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java Tue Mar  1 18:48:27 2011
@@ -36,13 +36,14 @@ import org.apache.activemq.ActiveMQConne
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.commons.logging.impl.SimpleLog;
 import org.apache.james.core.MailImpl;
 import org.apache.james.queue.api.ManageableMailQueue;
 import org.apache.james.queue.api.MailQueue.MailQueueItem;
 import org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import junit.framework.TestCase;
 
@@ -85,8 +86,9 @@ public class JMSMailQueueTest extends Te
     }
     
     protected JMSMailQueue createQueue(ConnectionFactory factory, String queueName) {
-        SimpleLog log = new SimpleLog("MockLog");
-        log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+        Logger log = LoggerFactory.getLogger("MockLog");
+        // slf4j can't set programmatically any log level. It's just a facade
+        // log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
         JMSMailQueue queue = new JMSMailQueue(factory, queueName, log );
         return queue;
     }

Modified: james/server/trunk/smtpserver/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/pom.xml?rev=1075975&r1=1075974&r2=1075975&view=diff
==============================================================================
--- james/server/trunk/smtpserver/pom.xml (original)
+++ james/server/trunk/smtpserver/pom.xml Tue Mar  1 18:48:27 2011
@@ -86,8 +86,8 @@
       <artifactId>apache-jspf-resolver</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency> 
     <dependency>
       <groupId>commons-configuration</groupId>
@@ -179,5 +179,10 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency> 
   </dependencies>
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message