Index: src/java/org/apache/james/imapserver/ImapHandler.java
===================================================================
--- src/java/org/apache/james/imapserver/ImapHandler.java	(revision 475827)
+++ src/java/org/apache/james/imapserver/ImapHandler.java	(working copy)
@@ -249,6 +249,7 @@
                 theWatchdog.reset();
             }
             // TODO is this unreachable code because of !handlerIsUp -> return?
+            getLogger().warn("Stopping watchdog after handling last request");
             theWatchdog.stop();
             

Index: src/java/org/apache/james/imapserver/ImapRequestLineReader.java
===================================================================
--- src/java/org/apache/james/imapserver/ImapRequestLineReader.java	(revision 475827)
+++ src/java/org/apache/james/imapserver/ImapRequestLineReader.java	(working copy)
@@ -23,6 +23,9 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+
 /**
  * Wraps the client input reader with a bunch of convenience methods, allowing lookahead=1
  * on the underlying character stream.
@@ -30,7 +33,7 @@
  *
  * @version $Revision: 109034 $
  */
-public class ImapRequestLineReader
+public class ImapRequestLineReader extends AbstractLogEnabled
 {
     private InputStream input;
     private OutputStream output;
@@ -61,6 +64,10 @@
         }
 
         if ( next == '\r' || next == '\n' ) {
+            final Logger logger = getLogger();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Missing argument: " + next);
+            }
             throw new ProtocolException( "Missing argument." );
         }
 
@@ -82,9 +89,14 @@
                 next = input.read();
             }
             catch ( IOException e ) {
+                final Logger logger = getLogger();
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Error reading from stream", e);
+                }
                 throw new ProtocolException( "Error reading from stream." );
             }
             if ( next == -1 ) {
+                getLogger().info("Unexpected end of stream.");
                 throw new ProtocolException( "Unexpected end of stream." );
             }
 
@@ -119,7 +131,10 @@
 
         // Check if we found extra characters.
         if ( next != '\n' ) {
-            // TODO debug log here and other exceptions
+            final Logger logger = getLogger();
+            if (logger.isWarnEnabled()) {
+                logger.warn("Expected end-of-line but was " + next);
+            }
             throw new ProtocolException( "Expected end-of-line, found more characters.");
         }
     }
@@ -157,7 +172,7 @@
                 int count = 0;
                 count = input.read( holder, readTotal, holder.length - readTotal );
                 if ( count == -1 ) {
-                    throw new ProtocolException( "Unexpectd end of stream." );
+                    throw new ProtocolException( "Unexpected end of stream." );
                 }
                 readTotal += count;
             }
@@ -166,6 +181,10 @@
             nextChar = 0;
         }
         catch ( IOException e ) {
+            final Logger logger = getLogger();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Error reading from stream: ", e);
+            }
             throw new ProtocolException( "Error reading from stream." );
         }
 
@@ -185,6 +204,10 @@
             output.flush();
         }
         catch ( IOException e ) {
+            final Logger logger = getLogger();
+            if (logger.isDebugEnabled()) {
+                logger.debug("Unexpected exception in sending command continuation request: ", e);
+            }
             throw new ProtocolException("Unexpected exception in sending command continuation request.");
         }
     }
Index: src/java/org/apache/james/imapserver/ImapRequestHandler.java
===================================================================
--- src/java/org/apache/james/imapserver/ImapRequestHandler.java	(revision 475827)
+++ src/java/org/apache/james/imapserver/ImapRequestHandler.java	(working copy)
@@ -61,15 +61,21 @@
             throws ProtocolException
     {
         ImapRequestLineReader request = new ImapRequestLineReader( input, output );
+        setupLogger(request);
+        
+        final Logger logger = getLogger();
         try {
             request.nextChar();
         }
         catch ( ProtocolException e ) {
+            if (logger.isInfoEnabled()) {
+                logger.info("Cannot handling request: ", e);
+            }
             return false;
         }
 
         ImapResponse response = new ImapResponse( output );
-        response.enableLogging(getLogger()); 
+        response.enableLogging(logger); 
 
         doProcessRequest( request, response, session );
