ibspan.log4jade.client
Class LoggerPlugin

java.lang.Object
  extended by ibspan.log4jade.client.LoggerPlugin
All Implemented Interfaces:
Serializable

public class LoggerPlugin
extends Object
implements Serializable

Logger plugin rovides a friendly way of managing the logging process. Only in the case of agent migration the user have to remember she is working with Log4JADE. Migration assumes that the agent which will be transferred consists only of serializable classes (classes which implements Serializable interface). Classes from Log4j package do not fulfill this condition because the most important pattern of Log4j is to provide static stateful Logger for each class. Therefore, the buffer of events has to be emptied and the the logging plugin -- shutdown (together with the Logger object) when agent is about to move, and initialize it again after its migration. Thus the user has only to use the following calling in her agent's implentation:

 
 protected void beforeMove() { plugin.handleBeforeMove(); }
 
*
 * 
 protected void afterMove() { plugin.handleAfterMove(); } 
 
to support continuation of logging in the case of agent mobility. Note also the second statement of the above code that forces the logging plugin to update the information about the context of the Logger – specifying a new location of the agent: a container name and a host.

After migration the user has also to remember about refreshing all references to the logger: via getLogger() method.

Author:
Maciej Gawinecki
See Also:
Serialized Form

Field Summary
static int BUFFER_MAX_SIZE
           
 
Constructor Summary
LoggerPlugin(Agent a, String team)
           
 
Method Summary
 Logger getLogger()
           
 void handleAfterMove()
          This function must be called after migration.
 void handleBeforeMove()
          This function must be called before migration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_MAX_SIZE

public static final int BUFFER_MAX_SIZE
See Also:
Constant Field Values
Constructor Detail

LoggerPlugin

public LoggerPlugin(Agent a,
                    String team)
Method Detail

getLogger

public Logger getLogger()

handleBeforeMove

public void handleBeforeMove()
This function must be called before migration.


handleAfterMove

public void handleAfterMove()
This function must be called after migration.