james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r645075 - /james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java
Date Sat, 05 Apr 2008 11:00:09 GMT
Author: rdonkin
Date: Sat Apr  5 04:00:09 2008
New Revision: 645075

URL: http://svn.apache.org/viewvc?rev=645075&view=rev
Log:
Reduce logging level. Logging stack traces at error upon RST is not a good idea.

Modified:
    james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java?rev=645075&r1=645074&r2=645075&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java
(original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/core/AbstractJamesHandler.java
Sat Apr  5 04:00:09 2008
@@ -25,6 +25,7 @@
 import org.apache.avalon.excalibur.pool.Poolable;
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -255,25 +256,29 @@
     public void handleConnection(Socket connection) throws IOException {
         initHandler(connection);
 
+        final Logger logger = getLogger();
         try {
             
             // Do something:
             handleProtocol();
             
-            getLogger().debug("Closing socket.");
+            logger.debug("Closing socket.");
         } catch (SocketException se) {
-            if (getLogger().isErrorEnabled()) {
-                StringBuffer errorBuffer =
+            // Indicates a problem at the underlying protocol level
+            if (logger.isWarnEnabled()) {
+                String message =
                     new StringBuffer(64)
                         .append("Socket to ")
                         .append(remoteHost)
                         .append(" (")
                         .append(remoteIP)
-                        .append(") closed remotely.");
-                getLogger().error(errorBuffer.toString(), se );
+                        .append("): ")
+                        .append(se.getMessage()).toString();
+                logger.warn(message);
+                logger.debug(se.getMessage(), se);
             }
         } catch ( InterruptedIOException iioe ) {
-            if (getLogger().isErrorEnabled()) {
+            if (logger.isErrorEnabled()) {
                 StringBuffer errorBuffer =
                     new StringBuffer(64)
                         .append("Socket to ")
@@ -281,19 +286,20 @@
                         .append(" (")
                         .append(remoteIP)
                         .append(") timeout.");
-                getLogger().error( errorBuffer.toString(), iioe );
+                logger.error( errorBuffer.toString(), iioe );
             }
         } catch ( IOException ioe ) {
-            if (getLogger().isErrorEnabled()) {
-                StringBuffer errorBuffer =
+            if (logger.isWarnEnabled()) {
+                String message =
                     new StringBuffer(256)
                             .append("Exception handling socket to ")
                             .append(remoteHost)
                             .append(" (")
                             .append(remoteIP)
                             .append(") : ")
-                            .append(ioe.getMessage());
-                getLogger().error( errorBuffer.toString(), ioe );
+                            .append(ioe.getMessage()).toString();
+                logger.warn(message);
+                logger.debug( ioe.getMessage(), ioe );
             }
         } catch (RuntimeException e) {
             errorHandler(e);



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


Mime
View raw message