added internal log level. added some crucial log lines. logging thread id
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 16 Dec 2007 21:33:10 +0000 (21:33 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 16 Dec 2007 21:33:10 +0000 (21:33 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1179 9efc2488-bf62-4759-914b-345cdb29e865

src/java/org/opensrf/Request.java
src/java/org/opensrf/Stack.java
src/java/org/opensrf/net/xmpp/XMPPReader.java
src/java/org/opensrf/util/Logger.java

index 46d648b..32977e0 100644 (file)
@@ -4,6 +4,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.List;
 import java.util.Date;
 import org.opensrf.net.xmpp.XMPPException;
+import org.opensrf.util.Logger;
 
 public class Request {
     
@@ -91,8 +92,8 @@ public class Request {
                 /** wait up to millis milliseconds for a result.  waitForMessage() 
                  * will return if a response to any request arrives, so we keep track
                  * of how long we've been waiting in total for a response to 
-                 * this request
-                 */
+                 * this request */
+
                 long start = new Date().getTime();
                 session.waitForMessage(millis);
                 millis -= new Date().getTime() - start;
index 36dba52..3e7e606 100644 (file)
@@ -58,6 +58,10 @@ public class Stack {
     }
 
     private static void processOSRFMessage(Session ses, Message msg) throws MethodException {
+
+        Logger.debug("received id=" + msg.getId() + 
+            " type=" + msg.getType() + " payload=" + msg.getPayload());
+
         if( ses instanceof ClientSession ) 
             processResponse((ClientSession) ses, msg);
         else
index 54f0722..dcaf8bd 100644 (file)
@@ -7,6 +7,7 @@ import java.util.Queue;
 import java.io.InputStream;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.Date;
+import org.opensrf.util.Logger;
 
 import com.ctc.wstx.stax.WstxInputFactory;
 
@@ -211,6 +212,8 @@ public class XMPPReader implements Runnable {
                            msg.setBody(msgBody.toString());
                            msg.setThread(msgThread.toString());
 
+                           Logger.internal("xmpp message from="+msgFrom+" " + msg.getBody());
+
                            msgQueue.offer(msg);
                            resetBuffers(); 
                            notifyCoreEvent();
index cc201fd..2923c23 100644 (file)
@@ -14,6 +14,7 @@ public class Logger {
     public static final short WARN  = 2;
     public static final short INFO  = 3;
     public static final short DEBUG = 4;
+    public static final short INTERNAL = 5;
 
     /** The global log instance */
     private static Logger instance;
@@ -70,6 +71,15 @@ public class Logger {
         instance.log(DEBUG, msg);
     }
 
+    /**
+     * Logs an internal message
+     * @param msg The message to log
+     */
+    public static void internal(String msg) {
+        instance.log(INTERNAL, msg);
+    }
+
+
     /** 
      * Appends the text representation of the log level
      * @param sb The stringbuffer to append to
@@ -81,6 +91,8 @@ public class Logger {
                 sb.append("DEBG"); break;
             case INFO:
                 sb.append("INFO"); break;
+            case INTERNAL:
+                sb.append("INT "); break;
             case WARN:
                 sb.append("WARN"); break;
             case ERROR:
@@ -102,6 +114,8 @@ public class Logger {
 
         sb.append(" [");
         appendLevelString(sb, level);
+        sb.append(":");
+        sb.append(Thread.currentThread().getId());
         sb.append("] ");
         sb.append(msg);
         return sb.toString();