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 rd...@apache.org on 2009/09/07 11:30:29 UTC

svn commit: r812057 - in /james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver: SMTPHandler.java SMTPSession.java

Author: rdonkin
Date: Mon Sep  7 09:30:25 2009
New Revision: 812057

URL: http://svn.apache.org/viewvc?rev=812057&view=rev
Log:
JAMES-917 Added getter for log to session.  https://issues.apache.org/jira/browse/JAMES-917

Modified:
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java
    james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPSession.java

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java?rev=812057&r1=812056&r2=812057&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java Mon Sep  7 09:30:25 2009
@@ -28,6 +28,9 @@
 import java.util.Map;
 import java.util.Random;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.impl.AvalonLogger;
 import org.apache.james.socket.CRLFDelimitedByteBuffer;
 import org.apache.james.socket.ProtocolHandler;
 import org.apache.james.socket.ProtocolHandlerHelper;
@@ -47,6 +50,8 @@
 	 */
 	private final static Random random = new Random();
 
+	private Log log = LogFactory.getLog(this.getClass());
+	
 	/**
 	 * The name of the currently parsed command
 	 */
@@ -108,6 +113,7 @@
      * @see org.apache.james.socket.ProtocolHandler#handleProtocol()
      */
     public void handleProtocol() throws IOException {
+        this.log = new AvalonLogger(helper.getAvalonLogger());
         smtpID = Integer.toString(random.nextInt(1024));
         relayingAllowed = theConfigData.isRelayingAllowed(helper.getRemoteIP());
         authSupported = theConfigData.isAuthRequired(helper.getRemoteIP());
@@ -408,4 +414,8 @@
     public boolean useHeloEhloEnforcement() {
         return getConfigurationData().useAddressBracketsEnforcement();
     }
+
+    public Log getLogger() {
+        return log;
+    }
 }

Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPSession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPSession.java?rev=812057&r1=812056&r2=812057&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPSession.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPSession.java Mon Sep  7 09:30:25 2009
@@ -21,6 +21,8 @@
 
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+
 /**
  * All the handlers access this interface to communicate with
  * SMTPHandler object
@@ -176,5 +178,11 @@
      * @param ms the time to sleep in milliseconds
      */
     void sleep(long ms);
+    
+    /**
+     * Gets the context sensitive log for this session.
+     * @return log, not null
+     */
+    Log getLogger();
 }
 



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