Index: river/src/main/java/org/jboss/marshalling/river/RiverMarshaller.java
===================================================================
--- river/src/main/java/org/jboss/marshalling/river/RiverMarshaller.java	(revision 351)
+++ river/src/main/java/org/jboss/marshalling/river/RiverMarshaller.java	Mon Apr 12 16:07:24 CEST 2010
@@ -59,6 +59,8 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.apache.log4j.Logger;
 import org.jboss.marshalling.AbstractMarshaller;
 import org.jboss.marshalling.ClassExternalizerFactory;
 import org.jboss.marshalling.ClassTable;
@@ -88,6 +90,8 @@
     private ObjectOutput objectOutput;
     private BlockMarshaller blockMarshaller;
 
+    private static final Logger log = Logger.getLogger(RiverMarshaller.class);
+
     protected RiverMarshaller(final RiverMarshallerFactory marshallerFactory, final SerializableClassRegistry registry, final MarshallingConfiguration configuration) throws IOException {
         super(marshallerFactory, configuration);
         final int configuredVersion = this.configuredVersion;
@@ -1388,6 +1392,7 @@
         final int configuredVersion = this.configuredVersion;
         int i = (configuredVersion >= 2 ? BASIC_CLASSES_V2 : BASIC_CLASSES).get(objClass, -1);
         if (i != -1) {
+            log.info("Known class found: " + objClass + ", write " + i);
             write(i);
             return true;
         }
Index: river/src/main/java/org/jboss/marshalling/river/RiverUnmarshaller.java
===================================================================
--- river/src/main/java/org/jboss/marshalling/river/RiverUnmarshaller.java	(revision 394)
+++ river/src/main/java/org/jboss/marshalling/river/RiverUnmarshaller.java	Mon Apr 12 15:39:43 CEST 2010
@@ -67,6 +67,8 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.apache.log4j.Logger;
 import org.jboss.marshalling.AbstractUnmarshaller;
 import org.jboss.marshalling.Creator;
 import org.jboss.marshalling.Externalizer;
@@ -94,6 +96,8 @@
 
     private static final Field proxyInvocationHandler;
 
+    private static final Logger log = Logger.getLogger(RiverUnmarshaller.class);
+
     static {
         proxyInvocationHandler = AccessController.doPrivileged(new PrivilegedAction<Field>() {
             public Field run() {
@@ -220,6 +224,7 @@
 
     @SuppressWarnings({ "unchecked" })
     Object doReadObject(int leadByte, final boolean unshared) throws IOException, ClassNotFoundException {
+        log.info("doReadObject");
         depth ++;
         try {
             for (;;) switch (leadByte) {
@@ -546,6 +551,7 @@
                     return CopyOnWriteArrayList.class;
                 }
                 case ID_CC_COPY_ON_WRITE_ARRAY_SET: {
+                    log.info("Read " + ID_CC_COPY_ON_WRITE_ARRAY_SET + ", so returning CopyOnWriteArraySet.class");
                     return CopyOnWriteArraySet.class;
                 }
                 case ID_CC_VECTOR: {
Index: api/src/main/java/org/jboss/marshalling/AbstractUnmarshaller.java
===================================================================
--- api/src/main/java/org/jboss/marshalling/AbstractUnmarshaller.java	(revision 276)
+++ api/src/main/java/org/jboss/marshalling/AbstractUnmarshaller.java	Mon Apr 12 18:30:44 CEST 2010
@@ -22,6 +22,8 @@
 
 package org.jboss.marshalling;
 
+import org.apache.log4j.Logger;
+
 import java.io.IOException;
 import java.io.EOFException;
 
@@ -52,6 +54,8 @@
     /** The current byte input. */
     protected ByteInput byteInput;
 
+    private static final Logger log = Logger.getLogger(AbstractUnmarshaller.class);
+
     /**
      * Construct a new unmarshaller instance.
      *
@@ -139,6 +143,7 @@
         }
         final int position = this.position;
         final int remaining = limit - position;
+        log.info("Read byte with, limit=" + limit + ", position=" + position + ", remaining=" + remaining + ", len=" + len);
         // pass through if the buffer is empty
         if (remaining == 0) {
             return byteInput.read(b, off, len);
@@ -258,6 +263,7 @@
 
     /** {@inheritDoc} */
     public byte readByte() throws IOException {
+       log.info("Before reading byte, limit=" + limit + ", position=" + position);
         final int limit;
         if ((limit = this.limit) == -1) {
             throw eofOnRead();
@@ -272,6 +278,7 @@
             return buffer[0];
         }
         this.position = position + 1;
+        log.info("After reading byte, limit=" + this.limit + ", position=" + this.position);
         return buffer[position];
     }
 
@@ -282,13 +289,16 @@
 
     /** {@inheritDoc} */
     public short readShort() throws IOException {
+        log.info("Before readShort, limit=" + limit + ", position=" + position);
         int position = this.position;
         int remaining = limit - position;
         if (remaining < 2) {
+            log.info("Less than 2 remaining, limit=" + this.limit + ", position=" + this.position + ", remaining=" + remaining);
             return (short) (readUnsignedByteDirect() << 8 | readUnsignedByteDirect());
         } else {
             final byte[] buffer = this.buffer;
             this.position = position + 2;
+            log.info("Plenty remaining, limit=" + this.limit + ", position=" + this.position + ", remaining=" + remaining);
             return (short) (buffer[position] << 8 | (buffer[position + 1] & 0xff));
         }
     }
@@ -307,6 +317,7 @@
     }
 
     protected int readUnsignedByteDirect() throws IOException {
+       log.info("Before readUnsignedByteDirect, limit=" + limit + ", position=" + position);
         final int limit;
         if ((limit = this.limit) == -1) {
             throw eofOnRead();
@@ -318,8 +329,10 @@
             if ((this.limit = byteInput.read(buffer)) == -1) {
                 throw eofOnRead();
             }
+            log.info("Have reached limit, read limit=" + this.limit + ", position=" + this.position);
             return buffer[0] & 0xff;
         }
+        log.info("Not yet at limit, limit=" + this.limit + ", position=" + this.position);
         return buffer[position] & 0xff;
     }
 
@@ -403,6 +416,7 @@
      * @throws IOException if I/O exception occurs
      */
     protected void doStart() throws IOException {
+        log.info("Read header which is " + streamHeader);
         streamHeader.readHeader(this);
     }
 }
Index: api/pom.xml
===================================================================
--- api/pom.xml	(revision 399)
+++ api/pom.xml	Mon Apr 12 16:07:51 CEST 2010
@@ -37,6 +37,11 @@
     <version>${jbmar.version}</version>
     <packaging>jar</packaging>
     <dependencies>
+       <dependency>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+          <version>1.2.14</version>
+       </dependency>
     </dependencies>
     <build>
         <plugins>
Index: river/pom.xml
===================================================================
--- river/pom.xml	(revision 399)
+++ river/pom.xml	Mon Apr 12 15:29:59 CEST 2010
@@ -42,6 +42,11 @@
             <artifactId>marshalling-api</artifactId>
             <version>${jbmar.version}</version>
         </dependency>
+       <dependency>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+          <version>1.2.14</version>
+       </dependency>
     </dependencies>
     <build>
         <plugins>
Index: api/src/main/java/org/jboss/marshalling/AbstractMarshaller.java
===================================================================
--- api/src/main/java/org/jboss/marshalling/AbstractMarshaller.java	(revision 351)
+++ api/src/main/java/org/jboss/marshalling/AbstractMarshaller.java	Mon Apr 12 16:36:15 CEST 2010
@@ -22,8 +22,11 @@
 
 package org.jboss.marshalling;
 
+import org.apache.log4j.Logger;
+
 import java.io.IOException;
 import java.io.NotActiveException;
+import java.util.Arrays;
 
 /**
  * An abstract implementation of the {@code Marshaller} interface.  Most of the
@@ -52,6 +55,8 @@
     /** The current byte output. */
     protected ByteOutput byteOutput;
 
+    private static final Logger log = Logger.getLogger(AbstractMarshaller.class);
+
     /**
      * Construct a new marshaller instance.
      *
@@ -344,6 +349,7 @@
     /** {@inheritDoc} */
     public void flush() throws IOException {
         final int pos = position;
+        log.info("Buffer at position " + pos + " before flushing: " + Arrays.toString(buffer));
         final ByteOutput byteOutput = this.byteOutput;
         if (byteOutput != null) {
             if (pos > 0) {
