[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

about LogListener




I modified Console.java, made it implement LogListener interface.
I want to make it to receive all log message and show these messages
to client console.
The logMsg(int,String):
     public void logMsg(int level, String msg) {
            System.out.println("listener: "+level+" "+msg);
            ...  //send message to consoleworker thread
     }

In PrimordialNode.java, I modified startConsole(Node,int):
private static void startConsole(Node node, int consolePort)
 {
     if (consolePort > -1)
     {
         Console con = null;
         int tries = 1;

         while ((tries != 0) && (tries < 15))
         {
          try
          {
              con = new Console(node, consolePort);
              tries = 0;
          }
          catch (IOException ioe)
          {
              tries++;
              consolePort++;
          }
         }

         if (con != null)
         {
         logger.addListener(con);        //add console to listeners of PrimordiaNode.logger
         node.addLogListener(con);       //add console to listeners of Node.logger
          Flow.currentFlow().threadStart(con, "Root Console");
          node.log(Log.NOTICE,
                "Started a control console on "
                +node.hostname()+ ":" +con.getPort());
         }
         else
         {
         {
          node.log(Log.NOTICE,
                "Unable to start a control console on port " +
                con.getPort());
         }
     }
    }

Then I run an application PingApplication, the console log listener
can receive :
listener: 7 sys *** Log Started
listener: 7 *** Log Started
listener: 5 Started a control console on zheng.nankai.edu.cn:7777

It cant receive the log of PingApplication, which is received by
StdoutListener.
sending 20 capsules at 300ms intervals
Sending primer capsule (and waiting 1000ms).
PingCapsule #0 (0 received) delivered to App!
PingCapsule #1 (1 received) delivered to App!
PingCapsule #2 (2 received) delivered to App!
PingCapsule #3 (3 received) delivered to App!
PingCapsule #4 (4 received) delivered to App!
PingCapsule #5 (5 received) delivered to App!
PingCapsule #6 (6 received) delivered to App!
PingCapsule #7 (7 received) delivered to App!
PingCapsule #8 (8 received) delivered to App!
PingCapsule #9 (9 received) delivered to App!
PingCapsule #10 (10 received) delivered to App!
PingCapsule #11 (11 received) delivered to App!
PingCapsule #12 (12 received) delivered to App!
PingCapsule #13 (13 received) delivered to App!
PingCapsule #14 (14 received) delivered to App!
PingCapsule #15 (15 received) delivered to App!
PingCapsule #16 (16 received) delivered to App!
PingCapsule #17 (17 received) delivered to App!
PingCapsule #18 (18 received) delivered to App!
Received almost all capsules.  Exiting.

Is there anything wrong?
Is the node which application get throught thisNode() not the node
which I add log listener to in the PrimordialNode?

-- 
Best regards,
 Rui






[ Janos ] [ OSKit ] [ Network Testbed ] [ Flick ] [ Fluke ]
Flux Research Group / Department of Computer Science / University of Utah