com.adventnet.utils
Class LogManager

java.lang.Object
  |
  +--com.adventnet.utils.LogManager

public class LogManager
extends java.lang.Object

The LogManager class manages the redirecting of debug messages and error messages from the SnmpSession class to client which sends request. The client has to implement the LogInterface. Log Manager will generate the unique id and it will give it to clients whoever registers with LogManager and client has to set the id in SnmpPDU class in case of LLAPI whereas in HLAPI like SnmpTarget and SnmnpRequestServer it is set in the PDU internally. The Log Manager will call the corresponding client's debug method


Field Summary
static int CRITICAL
           
static int DEBUG
           
static int DEFAULT
           
static int PERF
           
static int RESOURCES
           
static int SERIOUS
           
 
Constructor Summary
LogManager()
           
 
Method Summary
static int addLogClient(LoggerProperties props)
          Adds the Log client for redirecting the log messages.
static int addLogClient(LogInterface client)
          Subscribe for logging debug message.
static java.lang.Object getLogClient(int id)
          Returns the client that have registered to receive log messages or null is returned if no one is registered.
static java.util.Hashtable getLogClients()
          Returns the clients that have registered to receive log messages or null is returned if no one is registered.
static Logger getLogger(java.lang.String loggerInstanceName)
          Returns the Logger Instance corresponding to the given loggerInstanceName.
static LogWriter getLogWriter(java.lang.String logWriterInstanceName)
          Returns the LogWriter Instance corresponding to the given logWriterInstanceName.
static void logErrorMessage(java.lang.String e)
          Logging Error message of all clients This method is called by the api internally and no need for api users to implement this method.This method will call err() method of LogInterface implementation.
static void logInfoMessage(java.lang.String e)
          Logging Info message of all clients This method is called by the api internally and no need for api users to implement this method.This method will call out() method of LogInterface implementation.
static void logMessage(java.lang.String e)
          Calling debug message of all clients This method is called by SnmpSession class and no need for api users to implement this method.
static void logMessage(java.lang.String e, int id)
          Calling debug message of client This method is called by SnmpSession class and no need for api users to implement this method.
 void logMessage(java.lang.String msg, int level, int clientID)
          Logging the messages to the client corresponding to given clientID.
 void logMessage(java.lang.String msg, int level, java.lang.String loggerInstanceName)
          Logging the messages to the client corresponding to the loggerInstanceName.
static void removeLogClient(int id)
          Unsubscribe for debug messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRITICAL

public static final int CRITICAL

SERIOUS

public static final int SERIOUS

DEFAULT

public static final int DEFAULT

PERF

public static final int PERF

DEBUG

public static final int DEBUG

RESOURCES

public static final int RESOURCES
Constructor Detail

LogManager

public LogManager()
Method Detail

addLogClient

public static int addLogClient(LogInterface client)
Subscribe for logging debug message. This method adds the client to this LogManager session, to invoke the dbg() method of the LogInterface implemented by the client.
Parameters:
LogInterface - client client which implements Log Interface.
Returns:
int unique client id for setting in SnmpPDU while sending request.
See Also:
LogInterface

getLogClients

public static java.util.Hashtable getLogClients()
Returns the clients that have registered to receive log messages or null is returned if no one is registered.
Returns:
The clients that have registered for debug message or null.

getLogClient

public static java.lang.Object getLogClient(int id)
Returns the client that have registered to receive log messages or null is returned if no one is registered.
Parameters:
int - id client id .
Returns:
The client that have registered for debug message or null.

removeLogClient

public static void removeLogClient(int id)
Unsubscribe for debug messages. This method removes the client interface implementation from this Log Manager session.
See Also:
Log

logMessage

public static void logMessage(java.lang.String e,
                              int id)
Calling debug message of client This method is called by SnmpSession class and no need for api users to implement this method.

logMessage

public static void logMessage(java.lang.String e)
Calling debug message of all clients This method is called by SnmpSession class and no need for api users to implement this method.

logInfoMessage

public static void logInfoMessage(java.lang.String e)
Logging Info message of all clients This method is called by the api internally and no need for api users to implement this method.This method will call out() method of LogInterface implementation.

logErrorMessage

public static void logErrorMessage(java.lang.String e)
Logging Error message of all clients This method is called by the api internally and no need for api users to implement this method.This method will call err() method of LogInterface implementation.

addLogClient

public static int addLogClient(LoggerProperties props)
                        throws LogException
Adds the Log client for redirecting the log messages. This method can be called when advanced logging mechanism needs to be used. This method is used to create a new Logger which internally creates the a instance of LogWriter. If a LogWriter with the key given for the same doesnot exist, then a new LogFileWriter with this keyname will be created.
Parameters:
props - - A LoggerProperties instance having the properties of needed for a Logger which are grouped together.
Returns:
int A unique client id for setting in SnmpPDU while sending request.

logMessage

public void logMessage(java.lang.String msg,
                       int level,
                       java.lang.String loggerInstanceName)
Logging the messages to the client corresponding to the loggerInstanceName. This method will call out() method of Logger instance corresponding to the loggerInstanceName given with the message and level given as arguments.
Parameters:
msg - The message string to be logged.
level - The Loglevel for this corresponding logMessage.
loggerInstanceName - The key of the Logger whose out() method needs to be invoked with the message & level.

logMessage

public void logMessage(java.lang.String msg,
                       int level,
                       int clientID)
Logging the messages to the client corresponding to given clientID. This method will call out() method of Logger instance corresponding to the unique clientID given with the message and level given as arguments.
Parameters:
msg - The message string to be logged.
level - The Loglevel for this corresponding logMessage.
clientID - The unique value mapped to the Logger instance whose out() method needs to be invoked with the message & level.

getLogger

public static Logger getLogger(java.lang.String loggerInstanceName)
Returns the Logger Instance corresponding to the given loggerInstanceName.
Parameters:
loggerInstanceName - The LoggerInstanceName corresponding to which the Logger is to be obtained.
Returns:
The Logger instance if the loggerInstanceName matches, otherwise null.

getLogWriter

public static LogWriter getLogWriter(java.lang.String logWriterInstanceName)
Returns the LogWriter Instance corresponding to the given logWriterInstanceName.
Parameters:
logWriterInstanceName - The LogWriterInstanceName corresponding to which the LogWriter is to be obtained.
Returns:
The LogWriter instance if the logWriterInstanceName matches, otherwise null.


Copyright (c)AdventNet Inc., 1996-2004