[Opensrf-commits] r1179 - in trunk/src/java/org/opensrf: . net/xmpp util

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Dec 16 16:54:24 EST 2007


Author: erickson
Date: 2007-12-16 16:33:10 -0500 (Sun, 16 Dec 2007)
New Revision: 1179

Modified:
   trunk/src/java/org/opensrf/Request.java
   trunk/src/java/org/opensrf/Stack.java
   trunk/src/java/org/opensrf/net/xmpp/XMPPReader.java
   trunk/src/java/org/opensrf/util/Logger.java
Log:
added internal log level.  added some crucial log lines.  logging thread id

Modified: trunk/src/java/org/opensrf/Request.java
===================================================================
--- trunk/src/java/org/opensrf/Request.java	2007-12-16 21:06:49 UTC (rev 1178)
+++ trunk/src/java/org/opensrf/Request.java	2007-12-16 21:33:10 UTC (rev 1179)
@@ -4,6 +4,7 @@
 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 @@
                 /** 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;

Modified: trunk/src/java/org/opensrf/Stack.java
===================================================================
--- trunk/src/java/org/opensrf/Stack.java	2007-12-16 21:06:49 UTC (rev 1178)
+++ trunk/src/java/org/opensrf/Stack.java	2007-12-16 21:33:10 UTC (rev 1179)
@@ -58,6 +58,10 @@
     }
 
     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

Modified: trunk/src/java/org/opensrf/net/xmpp/XMPPReader.java
===================================================================
--- trunk/src/java/org/opensrf/net/xmpp/XMPPReader.java	2007-12-16 21:06:49 UTC (rev 1178)
+++ trunk/src/java/org/opensrf/net/xmpp/XMPPReader.java	2007-12-16 21:33:10 UTC (rev 1179)
@@ -7,6 +7,7 @@
 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 @@
                            msg.setBody(msgBody.toString());
                            msg.setThread(msgThread.toString());
 
+                           Logger.internal("xmpp message from="+msgFrom+" " + msg.getBody());
+
                            msgQueue.offer(msg);
                            resetBuffers(); 
                            notifyCoreEvent();

Modified: trunk/src/java/org/opensrf/util/Logger.java
===================================================================
--- trunk/src/java/org/opensrf/util/Logger.java	2007-12-16 21:06:49 UTC (rev 1178)
+++ trunk/src/java/org/opensrf/util/Logger.java	2007-12-16 21:33:10 UTC (rev 1179)
@@ -14,6 +14,7 @@
     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 @@
         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 @@
                 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 @@
 
         sb.append(" [");
         appendLevelString(sb, level);
+        sb.append(":");
+        sb.append(Thread.currentThread().getId());
         sb.append("] ");
         sb.append(msg);
         return sb.toString();



More information about the opensrf-commits mailing list