You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/08/24 03:46:58 UTC

[33/38] james-project git commit: JAMES-2114 Deprecate the mailet Logging APIs

JAMES-2114 Deprecate the mailet Logging APIs


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f35ab929
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f35ab929
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f35ab929

Branch: refs/heads/master
Commit: f35ab9299402a7f1c0c5f3787ae38de962803248
Parents: ecccda0
Author: benwa <bt...@linagora.com>
Authored: Tue Aug 15 14:33:40 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Aug 24 10:34:44 2017 +0700

----------------------------------------------------------------------
 .../james/ai/classic/BayesianAnalysis.java      | 23 ++---
 .../ai/classic/BayesianAnalysisFeeder.java      | 30 ++++---
 .../james/ai/classic/CorpusLoaderThread.java    | 12 ++-
 .../james/ai/classic/JDBCBayesianAnalyzer.java  | 91 +++++---------------
 .../org/apache/james/ai/classic/JDBCUtil.java   | 54 ++----------
 .../java/org/apache/james/ai/classic/Log.java   | 46 ----------
 .../org/apache/james/ai/classic/SystemLog.java  | 37 --------
 .../java/org/apache/mailet/MailetContext.java   | 10 ++-
 .../org/apache/mailet/base/GenericMailet.java   | 12 ++-
 .../org/apache/mailet/base/GenericMatcher.java  | 18 ++--
 .../james/transport/mailets/AbstractSign.java   | 73 ++++++++--------
 .../transport/mailets/SMIMECheckSignature.java  | 13 +--
 .../james/transport/mailets/SMIMEDecrypt.java   | 13 +--
 .../james/transport/mailets/SMIMESign.java      | 13 +--
 .../apache/james/transport/mailets/Sign.java    | 11 ++-
 .../james/transport/mailets/ICALToHeader.java   |  8 +-
 .../transport/mailets/ICALToJsonAttribute.java  | 15 ++--
 .../transport/mailets/ICalendarParser.java      |  8 +-
 mailet/standard/pom.xml                         |  1 -
 .../james/transport/mailets/AddFooter.java      |  9 +-
 .../transport/mailets/AddHabeasWarrantMark.java | 30 +++----
 .../transport/mailets/AmqpForwardAttribute.java |  7 +-
 .../james/transport/mailets/ClamAVScan.java     | 51 +++++------
 .../james/transport/mailets/ClassifyBounce.java | 24 +++---
 .../transport/mailets/ContentReplacer.java      | 10 +--
 .../james/transport/mailets/HeadersToHTTP.java  | 19 ++--
 .../james/transport/mailets/LogMessage.java     | 26 ++++--
 .../mailets/MailAttributesToMimeHeaders.java    |  5 +-
 .../transport/mailets/MimeDecodingMailet.java   |  9 +-
 .../james/transport/mailets/OnlyText.java       |  9 +-
 .../transport/mailets/RecoverAttachment.java    | 29 ++++---
 .../transport/mailets/RemoveMimeHeader.java     |  5 +-
 .../james/transport/mailets/ReplaceContent.java |  2 +-
 .../transport/mailets/SerialiseToHTTP.java      | 19 ++--
 .../james/transport/mailets/SetMimeHeader.java  | 12 +--
 .../transport/mailets/StripAttachment.java      | 15 ++--
 .../james/transport/mailets/ToProcessor.java    |  5 +-
 .../transport/mailets/UseHeaderRecipients.java  | 11 ++-
 .../james/transport/mailets/debug/Counter.java  |  7 +-
 .../transport/mailets/debug/DumpSystemErr.java  | 12 ++-
 .../matchers/AbstractQuotaMatcher.java          |  9 +-
 .../matchers/AttachmentFileNameIs.java          | 13 +--
 .../matchers/HasHabeasWarrantMark.java          | 17 ++--
 .../james/transport/matchers/SenderHostIs.java  |  5 +-
 .../transport/mailets/ContentReplacerTest.java  | 19 ++--
 .../james/transport/mailets/LogMessageTest.java |  4 +-
 .../util/bayesian/JDBCBayesianAnalyzer.java     | 23 ++---
 .../org/apache/james/util/sql/JDBCUtil.java     | 43 ++-------
 .../mailrepository/jdbc/JDBCMailRepository.java |  6 +-
 .../jdbc/MimeMessageJDBCSource.java             | 15 ++--
 .../rrt/jdbc/JDBCRecipientRewriteTable.java     |  6 +-
 .../user/jdbc/AbstractJdbcUsersRepository.java  |  6 +-
 .../library/netmatcher/NetMatcher.java          | 17 ++--
 .../impl/JamesMailetContext.java                |  6 +-
 .../mailets/AbstractRecipientRewriteTable.java  | 18 ++--
 .../transport/mailets/BayesianAnalysis.java     | 38 ++++----
 .../mailets/BayesianAnalysisFeeder.java         | 37 ++++----
 .../apache/james/transport/mailets/Bounce.java  | 11 ++-
 .../james/transport/mailets/DSNBounce.java      | 16 ++--
 .../apache/james/transport/mailets/Forward.java |  7 +-
 .../james/transport/mailets/FromRepository.java | 18 ++--
 .../james/transport/mailets/JDBCAlias.java      | 11 ++-
 .../mailets/JDBCRecipientRewriteTable.java      |  6 +-
 .../transport/mailets/NotifyPostmaster.java     |  9 +-
 .../james/transport/mailets/NotifySender.java   |  9 +-
 .../mailets/RecipientRewriteTableProcessor.java | 11 ++-
 .../james/transport/mailets/Redirect.java       |  8 +-
 .../james/transport/mailets/RemoteDelivery.java | 17 ++--
 .../apache/james/transport/mailets/Resend.java  |  7 +-
 .../org/apache/james/transport/mailets/SPF.java | 38 ++++----
 .../james/transport/mailets/SpamAssassin.java   | 15 ++--
 .../james/transport/mailets/ToRepository.java   |  5 +-
 .../james/transport/mailets/ToSenderFolder.java |  5 +-
 .../transport/mailets/WhiteListManager.java     | 46 +++++-----
 .../mailets/jsieve/SieveMailAdapter.java        |  6 +-
 .../mailets/managesieve/ManageSieveMailet.java  |  9 +-
 .../redirect/MailMessageAlteringUtils.java      | 11 ++-
 .../mailets/redirect/MailModifier.java          | 21 +++--
 .../mailets/redirect/ProcessRedirectNotify.java |  9 +-
 .../mailets/redirect/RedirectNotify.java        |  2 +
 .../matchers/AbstractNetworkMatcher.java        | 11 ++-
 .../matchers/AbstractSQLWhitelistMatcher.java   | 13 ++-
 .../james/transport/matchers/IsInWhiteList.java |  5 +-
 .../matchers/NetworkIsInWhitelist.java          |  5 +-
 .../transport/matchers/SenderInFakeDomain.java  | 13 +--
 .../transport/util/SpecialAddressesUtils.java   | 15 ++--
 .../james/samples/mailets/HelloWorldMailet.java | 10 +--
 .../samples/mailets/InstrumentationMailet.java  | 64 +++++++-------
 .../transport/mailets/RecordingMailContext.java |  6 +-
 .../fastfail/JDBCGreylistHandler.java           |  6 +-
 90 files changed, 739 insertions(+), 792 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
index abc350f..b96e5a2 100644
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
+++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
@@ -37,6 +37,8 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.RFC2822Headers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>
@@ -121,16 +123,17 @@ import org.apache.mailet.base.RFC2822Headers;
  * @since 2.3.0
  */
 @Experimental
-public class BayesianAnalysis extends GenericMailet implements Log {
+public class BayesianAnalysis extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(BayesianAnalysis.class);
     /**
      * The JDBCUtil helper class
      */
-    private final JDBCUtil theJDBCUtil = new JDBCUtil(this);
+    private final JDBCUtil theJDBCUtil = new JDBCUtil();
 
     /**
      * The JDBCBayesianAnalyzer class that does all the work.
      */
-    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer(this);
+    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer();
 
     DataSource datasource;
 
@@ -229,16 +232,16 @@ public class BayesianAnalysis extends GenericMailet implements Log {
         ignoreLocalSender = Boolean.valueOf(getInitParameter("ignoreLocalSender"));
 
         if (ignoreLocalSender) {
-            log("Will ignore messages coming from local senders");
+            LOGGER.debug("Will ignore messages coming from local senders");
         } else {
-            log("Will analyze messages coming from local senders");
+            LOGGER.debug("Will analyze messages coming from local senders");
         }
 
         String maxSizeParam = getInitParameter("maxSize");
         if (maxSizeParam != null) {
             setMaxSize(Integer.parseInt(maxSizeParam));
         }
-        log("maxSize: " + getMaxSize());
+        LOGGER.debug("maxSize: " + getMaxSize());
 
         String tag = getInitParameter("tagSubject");
         if (tag != null && tag.equals("false")) {
@@ -318,7 +321,7 @@ public class BayesianAnalysis extends GenericMailet implements Log {
             }
             if (probability > 0.1) {
                 final Collection<MailAddress> recipients = mail.getRecipients();
-                log(headerName + ": " + probabilityString + "; From: " + senderString + "; Recipient(s): " + getAddressesString(recipients));
+                LOGGER.debug(headerName + ": " + probabilityString + "; From: " + senderString + "; Recipient(s): " + getAddressesString(recipients));
 
                 // Check if we should tag the subject
                 if (tagSubject) {
@@ -329,7 +332,7 @@ public class BayesianAnalysis extends GenericMailet implements Log {
             saveChanges(message);
 
         } catch (Exception e) {
-            log("Exception: " + e.getMessage(), e);
+            LOGGER.error("Exception: " + e.getMessage(), e);
             throw new MessagingException("Exception thrown", e);
         }
     }
@@ -349,7 +352,7 @@ public class BayesianAnalysis extends GenericMailet implements Log {
                 analyzer.tokenCountsClear();
             }
 
-            log("BayesianAnalysis Corpus loaded");
+            LOGGER.error("BayesianAnalysis Corpus loaded");
 
             touchLastCorpusLoadTime();
 
@@ -389,7 +392,7 @@ public class BayesianAnalysis extends GenericMailet implements Log {
                 message.setSubject(toAppend + " " + subject, "iso-8859-1");
             }
         } catch (MessagingException ex) {
-            log("Failure to append to subject phrase: '" + toAppend + "'", ex);
+            LOGGER.error("Failure to append to subject phrase: '" + toAppend + "'", ex);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysisFeeder.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysisFeeder.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysisFeeder.java
index dd59c2f..cd00733 100644
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysisFeeder.java
+++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/BayesianAnalysisFeeder.java
@@ -34,6 +34,8 @@ import javax.sql.DataSource;
 import org.apache.mailet.Experimental;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>
@@ -125,16 +127,18 @@ import org.apache.mailet.base.GenericMailet;
  * @since 2.3.0
  */
 @Experimental
-public class BayesianAnalysisFeeder extends GenericMailet implements Log {
+public class BayesianAnalysisFeeder extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(BayesianAnalysisFeeder.class);
+
     /**
      * The JDBCUtil helper class
      */
-    private final JDBCUtil theJDBCUtil = new JDBCUtil(this);
+    private final JDBCUtil theJDBCUtil = new JDBCUtil();
 
     /**
      * The JDBCBayesianAnalyzer class that does all the work.
      */
-    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer(this);
+    private final JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer();
  
     private DataSource datasource;
 
@@ -209,7 +213,7 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
         if (maxSizeParam != null) {
             setMaxSize(Integer.parseInt(maxSizeParam));
         }
-        log("maxSize: " + getMaxSize());
+        LOGGER.debug("maxSize: " + getMaxSize());
 
         initDb();
 
@@ -250,7 +254,7 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
             String messageId = message.getMessageID();
 
             if (message.getSize() > getMaxSize()) {
-                log(messageId + " Feeding HAM/SPAM ignored because message size > " + getMaxSize() + ": " + message.getSize());
+                LOGGER.debug(messageId + " Feeding HAM/SPAM ignored because message size > " + getMaxSize() + ": " + message.getSize());
                 return;
             }
 
@@ -275,14 +279,14 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
                 analyzer.clear();
 
                 if ("ham".equalsIgnoreCase(feedType)) {
-                    log(messageId + " Feeding HAM");
+                    LOGGER.debug(messageId + " Feeding HAM");
                     // Process the stream as ham (not spam).
                     analyzer.addHam(br);
 
                     // Update storage statistics.
                     analyzer.updateHamTokens(conn);
                 } else {
-                    log(messageId + " Feeding SPAM");
+                    LOGGER.debug(messageId + " Feeding SPAM");
                     // Process the stream as spam.
                     analyzer.addSpam(br);
 
@@ -294,18 +298,18 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
                 if (conn != null && dbUpdated && !conn.getAutoCommit()) {
                     conn.commit();
                     dbUpdated = false;
-                    log(messageId + " Training ended successfully");
+                    LOGGER.debug(messageId + " Training ended successfully");
                     JDBCBayesianAnalyzer.touchLastDatabaseUpdateTime();
                 }
 
             }
 
         } catch (java.sql.SQLException se) {
-            log("SQLException: " + se.getMessage());
+            LOGGER.error("SQLException: ", se);
         } catch (java.io.IOException ioe) {
-            log("IOException: " + ioe.getMessage());
+            LOGGER.error("IOException: ", ioe);
         } catch (javax.mail.MessagingException me) {
-            log("MessagingException: " + me.getMessage());
+            LOGGER.error("MessagingException: ", me);
         } finally {
             // Rollback our changes if necessary.
             try {
@@ -314,7 +318,7 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
                     dbUpdated = false;
                 }
             } catch (Exception e) {
-                log("Failed to rollback after last error.", e);
+                LOGGER.error("Failed to rollback after last error.", e);
             }
             theJDBCUtil.closeJDBCConnection(conn);
         }
@@ -329,7 +333,7 @@ public class BayesianAnalysisFeeder extends GenericMailet implements Log {
             try {
                 message.removeHeader(header.getName());
             } catch (javax.mail.MessagingException me) {
-                log("Cannot remove header.", me);
+                LOGGER.error("Cannot remove header.", me);
             }
         }
         message.saveChanges();

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/CorpusLoaderThread.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/CorpusLoaderThread.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/CorpusLoaderThread.java
index 520da8a..46bcba4 100644
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/CorpusLoaderThread.java
+++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/CorpusLoaderThread.java
@@ -19,10 +19,14 @@
 
 package org.apache.james.ai.classic;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Periodically reloads corpus.
  */
 class CorpusLoaderThread extends Thread {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CorpusLoaderThread.class);
 
     private final BayesianAnalysis analysis;
 
@@ -35,19 +39,19 @@ class CorpusLoaderThread extends Thread {
      * Thread entry point.
      */
     public void run() {
-        analysis.log("CorpusLoader thread started: will wake up every " + BayesianAnalysis.CORPUS_RELOAD_INTERVAL + " ms");
+        LOGGER.info("CorpusLoader thread started: will wake up every " + BayesianAnalysis.CORPUS_RELOAD_INTERVAL + " ms");
 
         try {
             Thread.sleep(BayesianAnalysis.CORPUS_RELOAD_INTERVAL);
 
             while (true) {
                 if (analysis.getLastCorpusLoadTime() < JDBCBayesianAnalyzer.getLastDatabaseUpdateTime()) {
-                    analysis.log("Reloading Corpus ...");
+                    LOGGER.info("Reloading Corpus ...");
                     try {
                         analysis.loadData(analysis.datasource.getConnection());
-                        analysis.log("Corpus reloaded");
+                        LOGGER.info("Corpus reloaded");
                     } catch (java.sql.SQLException se) {
-                        analysis.log("SQLException: ", se);
+                        LOGGER.error("SQLException: ", se);
                     }
 
                 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
index e019b3f..366e0d5 100644
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
+++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
@@ -28,6 +28,8 @@ import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
 /**
@@ -42,20 +44,16 @@ import org.w3c.dom.Document;
  * @since 2.3.0
  */
 
-public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
+public class JDBCBayesianAnalyzer extends BayesianAnalyzer {
+    private static final Logger LOGGER = LoggerFactory.getLogger(JDBCBayesianAnalyzer.class);
 
     /** Public object representing a lock on database activity. */
     public final static String DATABASE_LOCK = "database lock";
-
-
     
     /**
      * The JDBCUtil helper class
      */
-    private final JDBCUtil theJDBCUtil = new JDBCUtil(this);
-
-    /** Logs messages. */
-    private Log log;
+    private final JDBCUtil theJDBCUtil = new JDBCUtil();
     
     /** Contains all of the sql strings for this component. */
     private final SqlResources sqlQueries = new SqlResources();
@@ -90,28 +88,6 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
     
     public JDBCBayesianAnalyzer() {
         super();
-        log = new SystemLog();
-    }
-    
-    public JDBCBayesianAnalyzer(Log log) {
-        super();
-        this.log = log;
-    }
-
-    /**
-     * Gets the current log.
-     * @return current log, not null
-     */
-    public Log getLog() {
-        return log;
-    }
-
-    /**
-     * Sets the current log.
-     * @param log not null
-     */
-    public void setLog(Log log) {
-        this.log = log;
     }
 
     /**
@@ -182,7 +158,7 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
                 }
             }
             // Verbose.
-            log("Ham tokens count: " + ham.size());
+            LOGGER.debug("Ham tokens count: " + ham.size());
 
             rs.close();
             pstmt.close();
@@ -202,7 +178,7 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             }
 
             // Verbose.
-            log("Spam tokens count: " + spam.size());
+            LOGGER.debug("Spam tokens count: " + spam.size());
 
             rs.close();
             pstmt.close();
@@ -222,8 +198,8 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (rs != null) {
                 try {
                     rs.close();
-                } catch (java.sql.SQLException se) {
-                    log("Failed to close statement after selecting spam tokens.", se);
+                } catch (SQLException se) {
+                    LOGGER.error("Failed to close statement after selecting spam tokens.", se);
                 }
 
                 rs = null;
@@ -232,8 +208,8 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (pstmt != null) {
                 try {
                     pstmt.close();
-                } catch (java.sql.SQLException se) {
-                    log("Failed to close statement selecting message counts.", se);
+                } catch (SQLException se) {
+                    LOGGER.error("Failed to close statement selecting message counts.", se);
                 }
 
                 pstmt = null;
@@ -303,15 +279,15 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (init != null) {
                 try {
                     init.close();
-                } catch (java.sql.SQLException ignore) {
-                    log("Failed to close statement after initializing message count.", ignore);
+                } catch (SQLException ignore) {
+                    LOGGER.error("Failed to close statement after initializing message count.", ignore);
                 }
             }
             if (update != null) {
                 try {
                     update.close();
-                } catch (java.sql.SQLException ignore) {
-                    log("Failed to close statement after setting message count.", ignore);
+                } catch (SQLException ignore) {
+                    LOGGER.error("Failed to close statement after setting message count.", ignore);
                 }
             }
         }
@@ -346,8 +322,8 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (insert != null) {
                 try {
                     insert.close();
-                } catch (java.sql.SQLException ignore) {
-                    log("Failed to close statement after updating tokens.", ignore);
+                } catch (SQLException ignore) {
+                    LOGGER.error("Failed to close statement after updating tokens.", ignore);
                 }
 
                 insert = null;
@@ -356,8 +332,8 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (update != null) {
                 try {
                     update.close();
-                } catch (java.sql.SQLException ignore) {
-                    log("Failed to close statement after updating tokens.", ignore);
+                } catch (SQLException ignore) {
+                    LOGGER.error("Failed to close statement after updating tokens.", ignore);
                 }
 
                 update = null;
@@ -430,7 +406,7 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
 
             StringBuffer logBuffer = null;
             logBuffer = new StringBuffer(64).append("Created table '").append(tableName).append("' using sqlResources string '").append(createSqlStringName).append("'.");
-            log(logBuffer.toString());
+            LOGGER.debug(logBuffer.toString());
 
         } finally {
             theJDBCUtil.closeJDBCStatement(createStatement);
@@ -450,35 +426,12 @@ public class JDBCBayesianAnalyzer extends BayesianAnalyzer implements Log {
             if (delete != null) {
                 try {
                     delete.close();
-                } catch (java.sql.SQLException ignore) {
-                    log("Failed to close statement after deleting ham statement. ", ignore);
+                } catch (SQLException ignore) {
+                    LOGGER.error("Failed to close statement after deleting ham statement. ", ignore);
                 }
                 
                 delete = null;
             }
         }
     }
-    
-    
-    /**
-     * Logs errors.
-     * 
-     * @param errorString
-     *            the error message generated
-     */
-    public void log(String errorString) {
-        log.log(errorString);
-    }
-
-    /**
-     * Logs errors.
-     * 
-     * @param errorString
-     *            the error message generated
-     * @param t 
-     *            exception 
-     */
-    public void log(String errorString, Throwable t) {
-        log.log(errorString, t);
-    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCUtil.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCUtil.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCUtil.java
index 76e81d1..440a346 100644
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCUtil.java
+++ b/mailet/ai/src/main/java/org/apache/james/ai/classic/JDBCUtil.java
@@ -26,6 +26,9 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Locale;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * <p>
  * Helper class for managing common JDBC tasks.
@@ -37,36 +40,10 @@ import java.util.Locale;
  * </p>
  */
 final class JDBCUtil {
-
-    private Log log;
-        
-    public JDBCUtil(Log log) {
-        super();
-        this.log = log;
-    }
+    private static final Logger LOGGER = LoggerFactory.getLogger(JDBCUtil.class);
 
     public JDBCUtil() {
         super();
-        this.log = new SystemLog();
-    }
-     
-    public Log getLog() {
-        return log;
-    }
-
-    public void setLog(Log log) {
-        this.log = log;
-    }
-
-    /**
-     * An abstract method which child classes override to handle logging of
-     * errors in their particular environments.
-     * 
-     * @param errorString
-     *            the error message generated
-     */
-    private void log(String errorString) {
-        log.log(errorString);
     }
 
     /**
@@ -165,7 +142,7 @@ final class JDBCUtil {
             }
         } catch (SQLException sqle) {
             // Log exception and continue
-            subclassLogWrapper("Unexpected exception while closing database connection.");
+            LOGGER.error("Unexpected exception while closing database connection.", sqle);
         }
     }
 
@@ -182,7 +159,7 @@ final class JDBCUtil {
             }
         } catch (SQLException sqle) {
             // Log exception and continue
-            subclassLogWrapper("Unexpected exception while closing database statement.");
+            LOGGER.error("Unexpected exception while closing database statement.", sqle);
         }
     }
 
@@ -199,24 +176,7 @@ final class JDBCUtil {
             }
         } catch (SQLException sqle) {
             // Log exception and continue
-            subclassLogWrapper("Unexpected exception while closing database result set.");
-        }
-    }
-
-    /**
-     * Wraps the delegated call to the subclass logging method with a Throwable
-     * wrapper. All throwables generated by the subclass logging method are
-     * caught and ignored.
-     * 
-     * @param logString
-     *            the raw string to be passed to the logging method implemented
-     *            by the subclass
-     */
-    private void subclassLogWrapper(String logString) {
-        try {
-            log(logString);
-        } catch (Throwable t) { //NOPMD
-            // Throwables generated by the logging system are ignored
+            LOGGER.error("Unexpected exception while closing database result set.", sqle);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/Log.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/Log.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/Log.java
deleted file mode 100644
index 9f1156a..0000000
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/Log.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.ai.classic;
-
-/**
- * A simple logging mechanism.
- */
-public interface Log {
-    
-    /**
-     * An abstract method which child classes override to handle logging of
-     * errors in their particular environments.
-     * 
-     * @param errorString
-     *            the error message generated
-     */
-    void log(String errorString);
-
-    /**
-     * An abstract method which child classes override to handle logging of
-     * errors in their particular environments.
-     * 
-     * @param errorString
-     *            the error message generated
-     * @param t 
-     *            exception 
-     */
-    void log(String errorString, Throwable t);
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemLog.java
----------------------------------------------------------------------
diff --git a/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemLog.java b/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemLog.java
deleted file mode 100644
index 6b1d65d..0000000
--- a/mailet/ai/src/main/java/org/apache/james/ai/classic/SystemLog.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.ai.classic;
-
-/**
- * Logs naively to system out. Not recommended for production.
- */
-public class SystemLog implements Log {
-    
-    @Override
-    public void log(String errorString) {
-        System.err.println("[AI Classic] " + errorString);
-    }
-
-    @Override
-    public void log(String errorString, Throwable t) {
-        System.err.println("[AI Classic] " + errorString);
-        t.printStackTrace();
-    } 
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/api/src/main/java/org/apache/mailet/MailetContext.java
----------------------------------------------------------------------
diff --git a/mailet/api/src/main/java/org/apache/mailet/MailetContext.java b/mailet/api/src/main/java/org/apache/mailet/MailetContext.java
index d9447a2..2b2dd96 100644
--- a/mailet/api/src/main/java/org/apache/mailet/MailetContext.java
+++ b/mailet/api/src/main/java/org/apache/mailet/MailetContext.java
@@ -62,7 +62,9 @@ public interface MailetContext {
      * Loglevel for logging operations
      *
      * @since Mailet API v2.5
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     enum LogLevel {
         DEBUG,
         INFO,
@@ -170,7 +172,7 @@ public interface MailetContext {
      * the mailet log is specific to the mailet container.
      *
      * @param message the message to be written to the log
-     * @deprecated use {@link #log(LogLevel level, String message)}
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
     @Deprecated
     void log(String message);
@@ -182,7 +184,7 @@ public interface MailetContext {
      *
      * @param message the message to be written to the log
      * @param t       the Throwable whose stack trace is to be written to the log
-     * @deprecated use {@link #log(LogLevel level, String message, Throwable t)}
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
     @Deprecated
     void log(String message, Throwable t);
@@ -195,7 +197,9 @@ public interface MailetContext {
      * @param level   {@link LogLevel} to use
      * @param message the message to be written to the log
      * @since 2.5
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     void log(LogLevel level, String message);
 
     /**
@@ -207,7 +211,9 @@ public interface MailetContext {
      * @param t       the Throwable whose stack trace is to be written to the log
      * @param level   {@link LogLevel} to use
      * @since 2.5
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     void log(LogLevel level, String message, Throwable t);
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/base/src/main/java/org/apache/mailet/base/GenericMailet.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/main/java/org/apache/mailet/base/GenericMailet.java b/mailet/base/src/main/java/org/apache/mailet/base/GenericMailet.java
index 3edeb37..53933fc 100644
--- a/mailet/base/src/main/java/org/apache/mailet/base/GenericMailet.java
+++ b/mailet/base/src/main/java/org/apache/mailet/base/GenericMailet.java
@@ -33,7 +33,8 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
-import org.apache.mailet.MailetContext.LogLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
@@ -50,6 +51,7 @@ import com.google.common.base.Strings;
  * @version 1.0.0, 24/04/1999
  */
 public abstract class GenericMailet implements Mailet, MailetConfig {
+    private static final Logger LOGGER = LoggerFactory.getLogger(GenericMailet.class);
 
     private static final String YES = "yes";
     private static final String NO = "no";
@@ -238,9 +240,11 @@ public abstract class GenericMailet implements Mailet, MailetConfig {
      * Writes the specified message to a mailet log file.
      *
      * @param message - a String specifying the message to be written to the log file
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     public void log(String message) {
-        getMailetContext().log(LogLevel.INFO, message);
+        LOGGER.info(message);
     }
 
     /**
@@ -249,9 +253,11 @@ public abstract class GenericMailet implements Mailet, MailetConfig {
      *
      * @param message - a String that describes the error or exception
      * @param t - the java.lang.Throwable to be logged
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     public void log(String message, Throwable t) {
-        getMailetContext().log(LogLevel.ERROR, message, t);
+        LOGGER.error(message, t);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/base/src/main/java/org/apache/mailet/base/GenericMatcher.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/main/java/org/apache/mailet/base/GenericMatcher.java b/mailet/base/src/main/java/org/apache/mailet/base/GenericMatcher.java
index 0670cd6..858ba6c 100644
--- a/mailet/base/src/main/java/org/apache/mailet/base/GenericMatcher.java
+++ b/mailet/base/src/main/java/org/apache/mailet/base/GenericMatcher.java
@@ -20,6 +20,8 @@
 
 package org.apache.mailet.base;
 
+import java.util.Collection;
+
 import javax.mail.MessagingException;
 
 import org.apache.mailet.Mail;
@@ -27,9 +29,8 @@ import org.apache.mailet.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.MatcherConfig;
-import org.apache.mailet.MailetContext.LogLevel;
-
-import java.util.Collection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>GenericMatcher implements the Matcher and MatcherConfig interfaces.</p>
@@ -43,7 +44,8 @@ import java.util.Collection;
  * @version 1.0.0, 24/04/1999
  */
 public abstract class GenericMatcher implements Matcher, MatcherConfig {
-    MatcherConfig config = null;
+    private static final Logger LOGGER = LoggerFactory.getLogger(GenericMatcher.class);
+    private MatcherConfig config = null;
 
     /**
      * Called by the mailet container to indicate to a matcher that the
@@ -143,9 +145,11 @@ public abstract class GenericMatcher implements Matcher, MatcherConfig {
      * Writes the specified message to a matcher log file.
      *
      * @param message - a String specifying the message to be written to the log file
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     public void log(String message) {
-        getMailetContext().log(LogLevel.INFO, message);
+        LOGGER.info(message);
     }
 
     /**
@@ -154,9 +158,11 @@ public abstract class GenericMatcher implements Matcher, MatcherConfig {
      *
      * @param message - a String that describes the error or exception
      * @param t - the java.lang.Throwable error or exception
+     * @deprecated Prefer using SLF4J LoggingFactory to get a Logger in each class
      */
+    @Deprecated
     public void log(String message, Throwable t) {
-        getMailetContext().log(LogLevel.ERROR, message, t);
+        LOGGER.error(message, t);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/crypto/src/main/java/org/apache/james/transport/mailets/AbstractSign.java
----------------------------------------------------------------------
diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/AbstractSign.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/AbstractSign.java
index 5320091..4baa77d 100644
--- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/AbstractSign.java
+++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/AbstractSign.java
@@ -21,14 +21,9 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.james.transport.KeyHolder;
-import org.apache.james.transport.SMIMEAttributeNames;
-import org.apache.james.user.api.UsersRepository;
-import org.apache.james.user.api.UsersRepositoryException;
-import org.apache.mailet.base.GenericMailet;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
-import org.apache.mailet.base.RFC2822Headers;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.Enumeration;
 
 import javax.inject.Inject;
 import javax.mail.MessagingException;
@@ -39,9 +34,16 @@ import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 import javax.mail.internet.ParseException;
 
-import java.io.IOException;
-import java.util.Enumeration;
-import java.lang.reflect.Constructor;
+import org.apache.james.transport.KeyHolder;
+import org.apache.james.transport.SMIMEAttributeNames;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.api.UsersRepositoryException;
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
+import org.apache.mailet.base.GenericMailet;
+import org.apache.mailet.base.RFC2822Headers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Objects;
 import com.google.common.base.Throwables;
@@ -105,6 +107,7 @@ import com.google.common.base.Throwables;
  * @since 2.2.1
  */
 public abstract class AbstractSign extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractSign.class);
     
     private static final String HEADERS_PATTERN = "[headers]";
     
@@ -199,7 +202,7 @@ public abstract class AbstractSign extends GenericMailet {
             throw new MessagingException("The specified <keyHolderClass> does not exist: " + keyHolderClassName);
         }
         if (isDebug()) {
-            log("keyHolderClass: " + getKeyHolderClass());
+            LOGGER.debug("keyHolderClass: " + getKeyHolderClass());
         }
     }
     
@@ -225,7 +228,7 @@ public abstract class AbstractSign extends GenericMailet {
     protected void initExplanationText() {
         setExplanationText(getInitParameter("explanationText"));
         if (isDebug()) {
-            log("Explanation text:\r\n" + getExplanationText());
+            LOGGER.debug("Explanation text:\r\n" + getExplanationText());
         }
     }
     
@@ -272,21 +275,21 @@ public abstract class AbstractSign extends GenericMailet {
         if (keyAliasPassword == null) {
             keyAliasPassword = keyStorePassword;
             if (isDebug()) {
-                log("<keyAliasPassword> parameter not specified: will default to the <keyStorePassword> parameter.");
+                LOGGER.debug("<keyAliasPassword> parameter not specified: will default to the <keyStorePassword> parameter.");
             }
         }
         
         String keyStoreType = getInitParameter("keyStoreType");
         if (keyStoreType == null) {
             if (isDebug()) {
-                log("<keyStoreType> parameter not specified: the default will be as appropriate to the keyStore requested.");
+                LOGGER.debug("<keyStoreType> parameter not specified: the default will be as appropriate to the keyStore requested.");
             }
         }
         
         String keyAlias = getInitParameter("keyAlias");
         if (keyAlias == null) {
             if (isDebug()) {
-                log("<keyAlias> parameter not specified: will look for the first one in the keystore.");
+                LOGGER.debug("<keyAlias> parameter not specified: will look for the first one in the keystore.");
             }
         }
         
@@ -298,7 +301,7 @@ public abstract class AbstractSign extends GenericMailet {
             .append(", keyStoreType=").append(keyStoreType)
             .append(", keyAlias=").append(keyAlias)
             .append(" ");
-            log(logBuffer.toString());
+            LOGGER.debug(logBuffer.toString());
         }
             
         // Certificate preparation
@@ -306,7 +309,7 @@ public abstract class AbstractSign extends GenericMailet {
         setKeyHolder((KeyHolder)keyHolderConstructor.newInstance(parameters));
         
         if (isDebug()) {
-            log("Subject Distinguished Name: " + getKeyHolder().getSignerDistinguishedName());
+            LOGGER.debug("Subject Distinguished Name: " + getKeyHolder().getSignerDistinguishedName());
         }
         
         if (getKeyHolder().getSignerAddress() == null) {
@@ -363,9 +366,9 @@ public abstract class AbstractSign extends GenericMailet {
         setRebuildFrom((getInitParameter("rebuildFrom") == null) ? false : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
-                log("Will modify the \"From:\" header.");
+                LOGGER.debug("Will modify the \"From:\" header.");
             } else {
-                log("Will leave the \"From:\" header unchanged.");
+                LOGGER.debug("Will leave the \"From:\" header unchanged.");
             }
         }
     }
@@ -405,7 +408,7 @@ public abstract class AbstractSign extends GenericMailet {
             }
             setSignerName(getKeyHolder().getSignerCN());
             if (isDebug()) {
-                log("<signerName> parameter not specified: will use the certificate signer \"CN=\" attribute.");
+                LOGGER.debug("<signerName> parameter not specified: will use the certificate signer \"CN=\" attribute.");
             }
         }
     }
@@ -441,7 +444,7 @@ public abstract class AbstractSign extends GenericMailet {
         try {
             initDebug();
             if (isDebug()) {
-                log("Initializing");
+                LOGGER.debug("Initializing");
             }
             
             initKeyHolderClass();
@@ -455,7 +458,7 @@ public abstract class AbstractSign extends GenericMailet {
         } catch (MessagingException me) {
             throw me;
         } catch (Exception e) {
-            log("Exception thrown", e);
+            LOGGER.error("Exception thrown", e);
             throw new MessagingException("Exception thrown", e);
         } finally {
             if (isDebug()) {
@@ -466,7 +469,7 @@ public abstract class AbstractSign extends GenericMailet {
                 .append(", postmasterSigns=").append(postmasterSigns)
                 .append(", rebuildFrom=").append(rebuildFrom)
                 .append(" ");
-                log(logBuffer.toString());
+                LOGGER.debug(logBuffer.toString());
             }
         }
         
@@ -535,14 +538,14 @@ public abstract class AbstractSign extends GenericMailet {
             mail.setAttribute(SMIMEAttributeNames.SMIME_SIGNER_ADDRESS, getKeyHolder().getSignerAddress());
             
             if (isDebug()) {
-                log("Message signed, reverse-path: " + mail.getSender() + ", Id: " + messageId);
+                LOGGER.debug("Message signed, reverse-path: " + mail.getSender() + ", Id: " + messageId);
             }
             
         } catch (MessagingException me) {
-            log("MessagingException found - could not sign!", me);
+            LOGGER.error("MessagingException found - could not sign!", me);
             throw me;
         } catch (Exception e) {
-            log("Exception found", e);
+            LOGGER.error("Exception found", e);
             throw new MessagingException("Exception thrown - could not sign!", e);
         }
         
@@ -573,14 +576,14 @@ public abstract class AbstractSign extends GenericMailet {
         
         // Is it a bounce?
         if (reversePath == null) {
-            log("Can not sign: no sender");
+            LOGGER.info("Can not sign: no sender");
             return false;
         }
         
         String authUser = (String) mail.getAttribute(Mail.SMTP_AUTH_USER_ATTRIBUTE_NAME);
         // was the sender user SMTP authorized?
         if (authUser == null) {
-            log("Can not sign mail for sender <" + mail.getSender() + "> as he is not a SMTP authenticated user");
+            LOGGER.info("Can not sign mail for sender <" + mail.getSender() + "> as he is not a SMTP authenticated user");
             return false;
         }
         
@@ -588,19 +591,19 @@ public abstract class AbstractSign extends GenericMailet {
         if (Objects.equal(getMailetContext().getPostmaster(), reversePath)) {
             // should not sign postmaster sent messages?
             if (!isPostmasterSigns()) {
-                log("Can not sign mails for postmaster");
+                LOGGER.info("Can not sign mails for postmaster");
                 return false;
             }
         } else {
             // is the reverse-path user different from the SMTP authorized user?
             String username = getUsername(reversePath);
             if (!username.equals(authUser)) {
-                log("SMTP logged in as <" + authUser + "> but pretend to be sender <" + username + ">");
+                LOGGER.info("SMTP logged in as <" + authUser + "> but pretend to be sender <" + username + ">");
                 return false;
             }
             // is there no "From:" address same as the reverse-path?
             if (!fromAddressSameAsReverse(mail)) {
-                log("Can not sign mails with empty FROM header field");
+                LOGGER.info("Can not sign mails with empty FROM header field");
                 return false;
             }
         }
@@ -610,7 +613,7 @@ public abstract class AbstractSign extends GenericMailet {
         boolean isAlreadySigned = mimeMessage.isMimeType("multipart/signed")
             || mimeMessage.isMimeType("application/pkcs7-mime");
         if (isAlreadySigned) {
-            log("Can not sign a mail already signed");
+            LOGGER.info("Can not sign a mail already signed");
         }
         return !isAlreadySigned;
 
@@ -658,7 +661,7 @@ public abstract class AbstractSign extends GenericMailet {
                     try {
                         mailAddress = new MailAddress(aFromArray);
                     } catch (ParseException pe) {
-                        log("Unable to parse a \"FROM\" header address: " + aFromArray.toString() + "; ignoring.");
+                        LOGGER.info("Unable to parse a \"FROM\" header address: " + aFromArray.toString() + "; ignoring.");
                         continue;
                     }
                     if (mailAddress.equals(reversePath)) {
@@ -667,7 +670,7 @@ public abstract class AbstractSign extends GenericMailet {
                 }
             }
         } catch (MessagingException me) {
-            log("Unable to parse the \"FROM\" header; ignoring.");
+            LOGGER.info("Unable to parse the \"FROM\" header; ignoring.");
         }
         
         return false;

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java
----------------------------------------------------------------------
diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java
index 6e1a52a..6ce9a51 100644
--- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java
+++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMECheckSignature.java
@@ -40,6 +40,8 @@ import org.apache.mailet.base.GenericMailet;
 import org.bouncycastle.cms.CMSException;
 import org.bouncycastle.mail.smime.SMIMEException;
 import org.bouncycastle.mail.smime.SMIMESigned;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>
@@ -100,6 +102,7 @@ import org.bouncycastle.mail.smime.SMIMESigned;
  * 
  */
 public class SMIMECheckSignature extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SMIMECheckSignature.class);
     
     protected KeyStoreHolder trustedCertificateStore;
     
@@ -133,7 +136,7 @@ public class SMIMECheckSignature extends GenericMailet {
         try {
             if (file != null) trustedCertificateStore = new KeyStoreHolder(file, password, type);
             else {
-                log("No trusted store path specified, using default store.");
+                LOGGER.info("No trusted store path specified, using default store.");
                 trustedCertificateStore = new KeyStoreHolder(password);
             }
         } catch (Exception e) {
@@ -166,20 +169,20 @@ public class SMIMECheckSignature extends GenericMailet {
             if (signed != null) {
                 signers = trustedCertificateStore.verifySignatures(signed);
                 strippedMessage = signed.getContent();
-            } else log("Content not identified as signed");
+            } else LOGGER.info("Content not identified as signed");
             
             // These errors are logged but they don't cause the 
             // message to change its state. The message 
             // is considered as not signed and the process will
             // go on.
         } catch (CMSException | SMIMEException e) {
-            log("Error during the analysis of the signed message", e);
+            LOGGER.error("Error during the analysis of the signed message", e);
             signers = null;
         } catch (IOException e) {
-            log("IO error during the analysis of the signed message", e);
+            LOGGER.error("IO error during the analysis of the signed message", e);
             signers = null;
         } catch (Exception e) {
-            log("Generic error occured during the analysis of the message", e);
+            LOGGER.error("Generic error occured during the analysis of the message", e);
             signers = null;
         }
         

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java
----------------------------------------------------------------------
diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java
index a3f138e..cfa1062 100644
--- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java
+++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMEDecrypt.java
@@ -45,6 +45,8 @@ import org.bouncycastle.cms.RecipientInformationStore;
 import org.bouncycastle.cms.jcajce.JceKeyTransEnvelopedRecipient;
 import org.bouncycastle.mail.smime.SMIMEEnveloped;
 import org.bouncycastle.mail.smime.SMIMEUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Charsets;
 
@@ -74,6 +76,7 @@ import com.google.common.base.Charsets;
  * 
  */
 public class SMIMEDecrypt extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SMIMEDecrypt.class);
 
     private SMIMEKeyHolder keyHolder;
     private X509CertificateHolder certificateHolder;
@@ -121,7 +124,7 @@ public class SMIMEDecrypt extends GenericMailet {
     public void service(Mail mail) throws MessagingException {
         MimeMessage message = mail.getMessage();
         Part strippedMessage = null;
-        log("Starting message decryption..");
+        LOGGER.info("Starting message decryption..");
         if (message.isMimeType("application/x-pkcs7-mime") || message.isMimeType("application/pkcs7-mime")) {
             try {
                 SMIMEEnveloped env = new SMIMEEnveloped(message);
@@ -134,12 +137,12 @@ public class SMIMEDecrypt extends GenericMailet {
                             JceKeyTransEnvelopedRecipient recipient = new JceKeyTransEnvelopedRecipient(keyHolder.getPrivateKey());
                             // strippedMessage contains the decrypted message.
                             strippedMessage = SMIMEUtil.toMimeBodyPart(info.getContent(recipient));
-                            log("Encrypted message decrypted");
+                            LOGGER.info("Encrypted message decrypted");
                         } catch (Exception e) {
                             throw new MessagingException("Error during the decryption of the message", e);
                         }
                     } else {
-                        log("Found an encrypted message but it isn't encrypted for the supplied key");
+                        LOGGER.info("Found an encrypted message but it isn't encrypted for the supplied key");
                     }
                 }
             } catch (CMSException e) {
@@ -167,8 +170,8 @@ public class SMIMEDecrypt extends GenericMailet {
                 }
                 newMessage.saveChanges();
                 mail.setMessage(newMessage);
-            } catch (IOException e) { 
-                log("Error during the strip of the encrypted message");
+            } catch (IOException e) {
+                LOGGER.error("Error during the strip of the encrypted message", e);
                 throw new MessagingException("Error during the stripping of the encrypted message",e);
             }
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMESign.java
----------------------------------------------------------------------
diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMESign.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMESign.java
index 629a8fa..bf7d464 100644
--- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMESign.java
+++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/SMIMESign.java
@@ -21,14 +21,16 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.Mail;
+import java.io.IOException;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 
-import java.io.IOException;
+import org.apache.mailet.Mail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>Puts a <I>server-side</I> SMIME signature on a message.
@@ -53,6 +55,7 @@ import java.io.IOException;
  * @since 2.3.0
  */
 public class SMIMESign extends Sign {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SMIMESign.class);
     
     /**
      * Return a string describing this mailet.
@@ -134,7 +137,7 @@ public class SMIMESign extends Sign {
             throw new MessagingException(keyHolderClassName + "does not exist.");
         }
         if (isDebug()) {
-            log("keyHolderClass: " + getKeyHolderClass());
+            LOGGER.debug("keyHolderClass: " + getKeyHolderClass());
         }
     }
     
@@ -152,9 +155,9 @@ public class SMIMESign extends Sign {
         setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
-                log("Will modify the \"From:\" header.");
+                LOGGER.debug("Will modify the \"From:\" header.");
             } else {
-                log("Will leave the \"From:\" header unchanged.");
+                LOGGER.debug("Will leave the \"From:\" header unchanged.");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/crypto/src/main/java/org/apache/james/transport/mailets/Sign.java
----------------------------------------------------------------------
diff --git a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/Sign.java b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/Sign.java
index 66cf4c9..c3e4fa7 100644
--- a/mailet/crypto/src/main/java/org/apache/james/transport/mailets/Sign.java
+++ b/mailet/crypto/src/main/java/org/apache/james/transport/mailets/Sign.java
@@ -21,14 +21,16 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.Mail;
+import java.io.IOException;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 
-import java.io.IOException;
+import org.apache.mailet.Mail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>Puts a <I>server-side</I> signature on a message.
@@ -59,6 +61,7 @@ import java.io.IOException;
  * @since 2.2.1
  */
 public class Sign extends AbstractSign {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Sign.class);
     
     /**
      * Return a string describing this mailet.
@@ -143,9 +146,9 @@ public class Sign extends AbstractSign {
         setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
-                log("Will modify the \"From:\" header.");
+                LOGGER.debug("Will modify the \"From:\" header.");
             } else {
-                log("Will leave the \"From:\" header unchanged.");
+                LOGGER.debug("Will leave the \"From:\" header unchanged.");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
----------------------------------------------------------------------
diff --git a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
index 82b2597..a4d287f 100644
--- a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
+++ b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
@@ -26,6 +26,8 @@ import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.annotations.VisibleForTesting;
@@ -56,6 +58,8 @@ import net.fortuna.ical4j.model.component.VEvent;
  * </pre>
  */
 public class ICALToHeader extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ICALToHeader.class);
+
     public static final String ATTRIBUTE_PROPERTY = "attribute";
     public static final String ATTRIBUTE_DEFAULT_NAME = "icalendar";
 
@@ -93,7 +97,7 @@ public class ICALToHeader extends GenericMailet {
                 .ifPresent(Throwing.<Calendar>consumer(calendar -> writeToHeaders(calendar, mail))
                     .sneakyThrow());
         } catch (ClassCastException e) {
-            log("Received a mail with " + attribute + " not being an ICAL object for mail " + mail.getName());
+            LOGGER.error("Received a mail with " + attribute + " not being an ICAL object for mail " + mail.getName(), e);
         }
     }
 
@@ -122,7 +126,7 @@ public class ICALToHeader extends GenericMailet {
             try {
                 mimeMessage.addHeader(headerName, property.getValue());
             } catch (MessagingException e) {
-                log("Could not add header " + headerName + " with value " + property.getValue(), e);
+                LOGGER.error("Could not add header " + headerName + " with value " + property.getValue(), e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToJsonAttribute.java
----------------------------------------------------------------------
diff --git a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToJsonAttribute.java b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToJsonAttribute.java
index 84ebabb..33eca9d 100644
--- a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToJsonAttribute.java
+++ b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToJsonAttribute.java
@@ -36,6 +36,8 @@ import org.apache.james.transport.mailets.model.ICAL;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -79,6 +81,7 @@ import net.fortuna.ical4j.model.Calendar;
  * </pre>
  */
 public class ICALToJsonAttribute extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ICALToJsonAttribute.class);
 
     public static final String SOURCE_ATTRIBUTE_NAME = "source";
     public static final String RAW_SOURCE_ATTRIBUTE_NAME = "rawSource";
@@ -140,7 +143,7 @@ public class ICALToJsonAttribute extends GenericMailet {
         }
         Optional<String> sender = retrieveSender(mail);
         if (!sender.isPresent()) {
-            log("Skipping " + mail.getName() + " because no sender and no from");
+            LOGGER.info("Skipping " + mail.getName() + " because no sender and no from");
             return;
         }
         try {
@@ -152,7 +155,7 @@ public class ICALToJsonAttribute extends GenericMailet {
                 .collect(Guavate.toImmutableMap(Pair::getKey, Pair::getValue));
             mail.setAttribute(destinationAttributeName, (Serializable) jsonsInByteForm);
         } catch (ClassCastException e) {
-            log("Received a mail with " + sourceAttributeName + " not being an ICAL object for mail " + mail.getName(), e);
+            LOGGER.error("Received a mail with " + sourceAttributeName + " not being an ICAL object for mail " + mail.getName(), e);
         }
     }
 
@@ -178,10 +181,10 @@ public class ICALToJsonAttribute extends GenericMailet {
         try {
             return Stream.of(objectMapper.writeValueAsString(ical));
         } catch (JsonProcessingException e) {
-            log("Error while serializing Calendar for mail " + mailName, e);
+            LOGGER.error("Error while serializing Calendar for mail " + mailName, e);
             return Stream.of();
         } catch (Exception e) {
-            log("Exception caught while attaching ICAL to the email as JSON for mail " + mailName, e);
+            LOGGER.error("Exception caught while attaching ICAL to the email as JSON for mail " + mailName, e);
             return Stream.of();
         }
     }
@@ -190,7 +193,7 @@ public class ICALToJsonAttribute extends GenericMailet {
         Calendar calendar = entry.getValue();
         byte[] rawICal = rawCalendars.get(entry.getKey());
         if (rawICal == null) {
-            log("Cannot find matching raw ICAL from key: " + entry.getKey());
+            LOGGER.debug("Cannot find matching raw ICAL from key: " + entry.getKey());
             return Stream.of();
         }
         try {
@@ -200,7 +203,7 @@ public class ICALToJsonAttribute extends GenericMailet {
                 .sender(sender)
                 .build());
         } catch (Exception e) {
-            log("Exception while converting calendar to ICAL", e);
+            LOGGER.error("Exception while converting calendar to ICAL", e);
             return Stream.of();
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICalendarParser.java
----------------------------------------------------------------------
diff --git a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICalendarParser.java b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICalendarParser.java
index 374bad4..3855bcd 100644
--- a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICalendarParser.java
+++ b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICalendarParser.java
@@ -29,6 +29,8 @@ import javax.mail.MessagingException;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.github.steveash.guavate.Guavate;
 import com.google.common.annotations.VisibleForTesting;
@@ -62,6 +64,8 @@ import net.fortuna.ical4j.util.CompatibilityHints;
  * </p>
  */
 public class ICalendarParser extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ICalendarParser.class);
+
     public static final String SOURCE_ATTRIBUTE_PARAMETER_NAME = "sourceAttribute";
     public static final String DESTINATION_ATTRIBUTE_PARAMETER_NAME = "destinationAttribute";
 
@@ -130,10 +134,10 @@ public class ICalendarParser extends GenericMailet {
             ByteArrayInputStream inputStream = new ByteArrayInputStream(icsContent);
             return Stream.of(Pair.of(key, builder.build(inputStream)));
         } catch (IOException e) {
-            log("Error while reading input: " + icsContent, e);
+            LOGGER.error("Error while reading input: " + icsContent, e);
             return Stream.of();
         } catch (ParserException e) {
-            log("Error while parsing ICal object: " + icsContent, e);
+            LOGGER.error("Error while parsing ICal object: " + icsContent, e);
             return Stream.of();
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/pom.xml
----------------------------------------------------------------------
diff --git a/mailet/standard/pom.xml b/mailet/standard/pom.xml
index ac396c1..cff5475 100644
--- a/mailet/standard/pom.xml
+++ b/mailet/standard/pom.xml
@@ -97,7 +97,6 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <scope>test</scope>
         </dependency>
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
index 7e1b38c..52b006a 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
@@ -35,6 +35,8 @@ import javax.mail.internet.MimePart;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.RFC2822Headers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Optional;
 
@@ -44,6 +46,7 @@ import com.google.common.base.Optional;
  * messages with alternate content types or with attachments.
  */
 public class AddFooter extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AddFooter.class);
 
     private static final String HTML_BR_TAG = "<br />";
     private static final String CARRIAGE_RETURN = "\r\n";
@@ -68,11 +71,11 @@ public class AddFooter extends GenericMailet {
             if (attachFooter(message)) {
                 message.saveChanges();
             } else {
-                log("Unable to add footer to mail " + mail.getName());
+                LOGGER.info("Unable to add footer to mail " + mail.getName());
             }
         } catch (UnsupportedEncodingException e) {
-            log("UnsupportedEncoding Unable to add footer to mail "
-                    + mail.getName());
+            LOGGER.warn("UnsupportedEncoding Unable to add footer to mail "
+                    + mail.getName(), e);
         } catch (IOException ioe) {
             throw new MessagingException("Could not read message", ioe);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddHabeasWarrantMark.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddHabeasWarrantMark.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddHabeasWarrantMark.java
index 9d50361..a51a6c6 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddHabeasWarrantMark.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddHabeasWarrantMark.java
@@ -21,10 +21,14 @@
 
 package org.apache.james.transport.mailets;
 
+import javax.mail.MessagingException;
+
 import org.apache.james.transport.matchers.HasHabeasWarrantMark;
 import org.apache.mailet.Experimental;
-import org.apache.mailet.base.GenericMailet ;
-import org.apache.mailet.Mail ;
+import org.apache.mailet.Mail;
+import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <p>This matcher adds the Hebeas Warrant Mark to a message.
@@ -83,8 +87,9 @@ import org.apache.mailet.Mail ;
  * </pre>
  */
 @Experimental
-public class AddHabeasWarrantMark extends GenericMailet
-{
+public class AddHabeasWarrantMark extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AddHabeasWarrantMark.class);
+
     /**
      * Called by the mailet container to allow the mailet to process to
      * a message message.
@@ -97,22 +102,18 @@ public class AddHabeasWarrantMark extends GenericMailet
      * @throws javax.mail.MessagingException - if an message or address parsing exception occurs or
      *      an exception that interferes with the mailet's normal operation
      */
-    public void service(Mail mail) throws javax.mail.MessagingException
-    {
-        try
-        {
+    public void service(Mail mail) throws MessagingException {
+        try {
             javax.mail.internet.MimeMessage message = mail.getMessage();
 
-            for(int i = 0 ; i < HasHabeasWarrantMark.warrantMark.length ; i++)
-            {
+            for(int i = 0 ; i < HasHabeasWarrantMark.warrantMark.length ; i++) {
                 message.setHeader(HasHabeasWarrantMark.warrantMark[i][0], HasHabeasWarrantMark.warrantMark[i][1]);
             }
 
             message.saveChanges();
         }
-        catch (javax.mail.MessagingException me)
-        {
-            log(me.getMessage());
+        catch (MessagingException me) {
+            LOGGER.error("Error while adding habeas", me);
         }
     }
 
@@ -121,8 +122,7 @@ public class AddHabeasWarrantMark extends GenericMailet
      *
      * @return a string describing this mailet
      */
-    public String getMailetInfo()
-    {
+    public String getMailetInfo() {
         return "Add Habeas Warrant Mark.  Must be used in accordance with a license from Habeas (see http://www.habeas.com for details).";
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
index 360898d..7d1b104 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
@@ -27,6 +27,8 @@ import java.util.concurrent.TimeoutException;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailetException;
 import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Strings;
@@ -52,6 +54,7 @@ import com.rabbitmq.client.ConnectionFactory;
  * sending it.
  */
 public class AmqpForwardAttribute extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(AmqpForwardAttribute.class);
 
     public static final String URI_PARAMETER_NAME = "uri";
     public static final String EXCHANGE_PARAMETER_NAME = "exchange";
@@ -105,9 +108,9 @@ public class AmqpForwardAttribute extends GenericMailet {
         try {
             sendContent(content);
         } catch (IOException e) {
-            log("IOException while writing to AMQP: " + e.getMessage(), e);
+            LOGGER.error("IOException while writing to AMQP: " + e.getMessage(), e);
         } catch (TimeoutException e) {
-            log("TimeoutException while writing to AMQP: " + e.getMessage(), e);
+            LOGGER.error("TimeoutException while writing to AMQP: " + e.getMessage(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
index 8be918b..0e4bc26 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
@@ -45,6 +45,8 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.RFC2822Headers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -181,6 +183,7 @@ import org.apache.mailet.base.RFC2822Headers;
  */
 @Experimental
 public class ClamAVScan extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ClamAVScan.class);
 
     private static final int DEFAULT_PORT = 3310;
 
@@ -298,7 +301,7 @@ public class ClamAVScan extends GenericMailet {
     protected void initHost() throws UnknownHostException {
         setHost(getInitParameter("host"));
         if (isDebug()) {
-            log("host: " + getHost());
+            LOGGER.debug("host: " + getHost());
         }
     }
 
@@ -337,7 +340,7 @@ public class ClamAVScan extends GenericMailet {
         String portParam = getInitParameter("port");
         setPort((portParam == null) ? DEFAULT_PORT : Integer.parseInt(portParam));
         if (isDebug()) {
-            log("port: " + getPort());
+            LOGGER.debug("port: " + getPort());
         }
     }
 
@@ -368,7 +371,7 @@ public class ClamAVScan extends GenericMailet {
         String maxPingsParam = getInitParameter("maxPings");
         setMaxPings((maxPingsParam == null) ? DEFAULT_MAX_PINGS : Integer.parseInt(maxPingsParam));
         if (isDebug()) {
-            log("maxPings: " + getMaxPings());
+            LOGGER.debug("maxPings: " + getMaxPings());
         }
     }
 
@@ -399,7 +402,7 @@ public class ClamAVScan extends GenericMailet {
         String pingIntervalMilliParam = getInitParameter("pingIntervalMilli");
         setPingIntervalMilli((pingIntervalMilliParam == null) ? DEFAULT_PING_INTERVAL_MILLI : Integer.parseInt(pingIntervalMilliParam));
         if (isDebug()) {
-            log("pingIntervalMilli: " + getPingIntervalMilli());
+            LOGGER.debug("pingIntervalMilli: " + getPingIntervalMilli());
         }
     }
 
@@ -430,7 +433,7 @@ public class ClamAVScan extends GenericMailet {
         String streamBufferSizeParam = getInitParameter("streamBufferSize");
         setStreamBufferSize((streamBufferSizeParam == null) ? DEFAULT_STREAM_BUFFER_SIZE : Integer.parseInt(streamBufferSizeParam));
         if (isDebug()) {
-            log("streamBufferSize: " + getStreamBufferSize());
+            LOGGER.debug("streamBufferSize: " + getStreamBufferSize());
         }
     }
 
@@ -535,7 +538,7 @@ public class ClamAVScan extends GenericMailet {
             do {
                 if (usedAddresses.size() >= getAddressesCount()) {
                     String logText = "Unable to connect to CLAMD. All addresses failed.";
-                    log(logText + " Giving up.");
+                    LOGGER.debug(logText + " Giving up.");
                     throw new MessagingException(logText);
                 }
                 address = getNextAddress();
@@ -544,8 +547,8 @@ public class ClamAVScan extends GenericMailet {
                 // get the socket
                 return new Socket(address, getPort());
             } catch (IOException ioe) {
-                log("Exception caught acquiring main socket to CLAMD on "
-                        + address + " on port " + getPort() + ": " + ioe.getMessage());
+                LOGGER.error("Exception caught acquiring main socket to CLAMD on "
+                        + address + " on port " + getPort() + ": ", ioe);
                 getNextAddress();
                 // retry
             }
@@ -563,7 +566,7 @@ public class ClamAVScan extends GenericMailet {
         try {
             initDebug();
             if (isDebug()) {
-                log("Initializing");
+                LOGGER.debug("Initializing");
             }
 
             initHost();
@@ -578,7 +581,7 @@ public class ClamAVScan extends GenericMailet {
             }
 
         } catch (Exception e) {
-            log("Exception thrown", e);
+            LOGGER.error("Exception thrown", e);
             throw new MessagingException("Exception thrown", e);
         }
     }
@@ -599,7 +602,7 @@ public class ClamAVScan extends GenericMailet {
         MimeMessage mimeMessage = mail.getMessage();
 
         if (mimeMessage == null) {
-            log("Null MimeMessage. Will send to ghost");
+            LOGGER.debug("Null MimeMessage. Will send to ghost");
             // write mail info to log
             logMailInfo(mail);
             mail.setState(Mail.GHOST);
@@ -648,7 +651,7 @@ public class ClamAVScan extends GenericMailet {
                     if (answer.substring(answer.length() - FOUND_STRING.length()).equals(FOUND_STRING)) {
                         virusFound = true;
                         logMessage = answer + " (by CLAMD on " + socket.getInetAddress() + ")";
-                        log(logMessage);
+                        LOGGER.debug(logMessage);
                     }
                 } else {
                     break;
@@ -683,7 +686,7 @@ public class ClamAVScan extends GenericMailet {
 
             } else {
                 if (isDebug()) {
-                    log("OK (by CLAMD on " + socket.getInetAddress() + ")");
+                    LOGGER.debug("OK (by CLAMD on " + socket.getInetAddress() + ")");
                 }
                 mail.setAttribute(MAIL_ATTRIBUTE_NAME, "false");
 
@@ -695,11 +698,11 @@ public class ClamAVScan extends GenericMailet {
             try {
                 saveChanges(mimeMessage);
             } catch (Exception ex) {
-                log("Exception caught while saving changes (header) to the MimeMessage. Ignoring ...", ex);
+                LOGGER.error("Exception caught while saving changes (header) to the MimeMessage. Ignoring ...", ex);
             }
 
         } catch (Exception ex) {
-            log("Exception caught calling CLAMD on " + socket.getInetAddress() + ": " + ex.getMessage(), ex);
+            LOGGER.error("Exception caught calling CLAMD on " + socket.getInetAddress() + ": " + ex.getMessage(), ex);
             throw new MessagingException("Exception caught", ex);
         } finally {
             IOUtils.closeQuietly(reader);
@@ -735,16 +738,16 @@ public class ClamAVScan extends GenericMailet {
         int ping = 1;
         for (; ; ) {
             if (isDebug()) {
-                log("Trial #" + ping + "/" + getMaxPings() + " - creating socket connected to " + address + " on port " + getPort());
+                LOGGER.debug("Trial #" + ping + "/" + getMaxPings() + " - creating socket connected to " + address + " on port " + getPort());
             }
             try {
                 socket = new Socket(address, getPort());
                 break;
             } catch (ConnectException ce) {
-                log("Trial #" + ping + "/" + getMaxPings() + " - exception caught: " + ce.toString() + " while creating socket connected to " + address + " on port " + getPort());
+                LOGGER.debug("Trial #" + ping + "/" + getMaxPings() + " - exception caught: " + ce.toString() + " while creating socket connected to " + address + " on port " + getPort());
                 ping++;
                 if (ping <= getMaxPings()) {
-                    log("Waiting " + getPingIntervalMilli() + " milliseconds before retrying ...");
+                    LOGGER.debug("Waiting " + getPingIntervalMilli() + " milliseconds before retrying ...");
                     Thread.sleep(getPingIntervalMilli());
                 } else {
                     break;
@@ -762,7 +765,7 @@ public class ClamAVScan extends GenericMailet {
             BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ASCII"));
             PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true);
 
-            log("Sending: \"PING\" to " + address + " ...");
+            LOGGER.debug("Sending: \"PING\" to " + address + " ...");
             writer.println("PING");
             writer.flush();
 
@@ -771,7 +774,7 @@ public class ClamAVScan extends GenericMailet {
                 String answer = reader.readLine();
                 if (answer != null) {
                     answer = answer.trim();
-                    log("Received: \"" + answer + "\"");
+                    LOGGER.debug("Received: \"" + answer + "\"");
                     answer = answer.trim();
                     if (answer.equals("PONG")) {
                         pongReceived = true;
@@ -806,7 +809,7 @@ public class ClamAVScan extends GenericMailet {
             try {
                 port = Integer.parseInt(portSubstring);
             } catch (NumberFormatException nfe) {
-                log("Can not parse port from substring " + portSubstring);
+                LOGGER.error("Can not parse port from substring " + portSubstring);
             }
         }
 
@@ -844,7 +847,7 @@ public class ClamAVScan extends GenericMailet {
             out.print(", " + rcptTo.next());
         }
 
-        log(sout.toString());
+        LOGGER.debug(sout.toString());
     }
 
     private void logMessageInfo(MimeMessage mimeMessage) {
@@ -893,10 +896,10 @@ public class ClamAVScan extends GenericMailet {
                 out.print(", Number of lines: " + mimeMessage.getLineCount());
             }
         } catch (MessagingException me) {
-            log("Exception caught reporting message details", me);
+            LOGGER.error("Exception caught reporting message details", me);
         }
 
-        log(sout.toString());
+        LOGGER.debug(sout.toString());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f35ab929/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
index 7ad4d72..e33af5a 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
@@ -18,20 +18,23 @@
  ****************************************************************/
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.Experimental;
-import org.apache.mailet.Mail;
-import org.apache.mailet.base.GenericMailet;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.mail.BodyPart;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
 import javax.mail.internet.MimeMessage;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+
+import org.apache.mailet.Experimental;
+import org.apache.mailet.Mail;
+import org.apache.mailet.base.GenericMailet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -45,6 +48,7 @@ import java.util.regex.Pattern;
  */
 @Experimental
 public class ClassifyBounce extends GenericMailet {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ClassifyBounce.class);
 
     /**
      * The name of the header to be added.
@@ -78,8 +82,8 @@ public class ClassifyBounce extends GenericMailet {
             message.setHeader(headerName, classification);
             message.saveChanges();
             //}
-        } catch (javax.mail.MessagingException me) {
-            log("Error classifying message: " + me.getMessage());
+        } catch (MessagingException me) {
+            LOGGER.error("Error classifying message: ", me);
         }
     }
 


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