NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.stack
Class ServerLog

java.lang.Object
  |
  +--gov.nist.javax.sip.stack.ServerLog

public class ServerLog
extends Object

Log file wrapper class. Log messages into the message trace file and also write the log into the debug file if needed. This class keeps an XML formatted trace around for later access via RMI. The trace can be viewed with a trace viewer (see tools.traceviewerapp).

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan
This code is in the public domain.

Field Summary
static int TRACE_DEBUG
          Debug trace level (all tracing enabled).
static int TRACE_EXCEPTION
          Trace exception processing
static int TRACE_MESSAGES
           
static int TRACE_NONE
          Dont trace
 
Constructor Summary
ServerLog()
           
 
Method Summary
static void checkLogFile()
           
static void commitRemoteLog()
          Commit the log information to the remote repository.
static String getLogFileName()
          return the name of the log file.
static gov.nist.javax.sip.stack.MessageLogTableImpl getMessageLogTable()
          Return the message log table.
static int getTraceLevel()
          Get the trace level for the stack.
static void initMessageLogTable(String stackAddress, int rmiPort, String rootName, int traceLifeTime)
          Initialize the table for RMI access to the log file.
static void logException(Exception ex)
          Log an exception stack trace.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, boolean sender)
          Log a message into the log directory.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, boolean sender, long time)
          Log a message into the log directory.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, boolean sender, String time)
          Log a message into the log directory.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, String status, boolean sender)
          Log a message into the log directory.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, String status, boolean sender, long time)
          Log a message into the log directory.
static void logMessage(gov.nist.javax.sip.message.SIPMessage message, String from, String to, String status, boolean sender, String time)
          Log a message into the log directory.
static void logMessage(String message)
          Log a message into the log file.
static void logMessage(String message, String from, String to, String cseq, boolean sender, String callId, String firstLine, String status, String tid)
          Log a message into the log directory.
static void logMessage(String message, String from, String to, String cseq, boolean sender, String callId, String firstLine, String status, String tid, long time)
           
static void logMessage(String message, String from, String to, String cseq, boolean sender, String callId, String firstLine, String status, String tid, String time)
          Log a message into the log directory.
static boolean needsLogging()
          Global check for whether to log or not.
static boolean needsLogging(int logLevel)
          Check to see if logging is enabled at a level (avoids unecessary message formatting.
static void println(String s)
          print a line to stdout if the traceLevel is TRACE_DEBUG.
static void setAuxInfo(String auxInfo)
          Set aux information.
static void setDescription(String desc)
          Set the descriptive String for the log.
static void setLogFileName(String name)
          Set the log file name
static void setLogName(String name)
          Set the name to assign for the log.
static void setRemoteRepository(String repositoryName)
          Set the remote repository name.
static void setTraceLevel(int level)
          Set the trace level for the stack.
static void traceMsg(int msgLevel, String tracemsg)
          Log a message into the log file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE_NONE

public static int TRACE_NONE
Dont trace


TRACE_MESSAGES

public static int TRACE_MESSAGES

TRACE_EXCEPTION

public static int TRACE_EXCEPTION
Trace exception processing


TRACE_DEBUG

public static int TRACE_DEBUG
Debug trace level (all tracing enabled).

Constructor Detail

ServerLog

public ServerLog()
Method Detail

checkLogFile

public static void checkLogFile()

needsLogging

public static boolean needsLogging(int logLevel)
Check to see if logging is enabled at a level (avoids unecessary message formatting.

Parameters:
logLevel - level at which to check.

needsLogging

public static boolean needsLogging()
Global check for whether to log or not. To minimize the time return false here.

Returns:
true -- if logging is globally enabled and false otherwise.

setLogFileName

public static void setLogFileName(String name)
Set the log file name

Parameters:
name - is the name of the log file to set.

getLogFileName

public static String getLogFileName()
return the name of the log file.


logMessage

public static void logMessage(String message)
Log a message into the log file.

Parameters:
message - message to log into the log file.

logMessage

public static void logMessage(String message,
                              String from,
                              String to,
                              String cseq,
                              boolean sender,
                              String callId,
                              String firstLine,
                              String status,
                              String tid,
                              String time)
Log a message into the log directory.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
cseq - cseq header of the message to log into the log directory
sender - is the server the sender (true if I am the sender).
callId - CallId of the message to log into the log directory.
firstLine - First line of the message to display
status - Status information (generated while processing message).
time - the reception time (or date).

logMessage

public static void logMessage(String message,
                              String from,
                              String to,
                              String cseq,
                              boolean sender,
                              String callId,
                              String firstLine,
                              String status,
                              String tid,
                              long time)

logMessage

public static void logMessage(String message,
                              String from,
                              String to,
                              String cseq,
                              boolean sender,
                              String callId,
                              String firstLine,
                              String status,
                              String tid)
Log a message into the log directory.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
cseq - cseq header of the message to log into the log directory
sender - is the server the sender
callId - CallId of the message to log into the log directory.
firstLine - First line of the message to display
status - Status information (generated while processing message).
tid - is the transaction id for the message.

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              boolean sender,
                              String time)
Log a message into the log directory. Status information is extracted from the NISTExtension Header.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
sender - is the server the sender
time - is the time to associate with the message.

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              boolean sender,
                              long time)
Log a message into the log directory. Status information is extracted from the NISTExtension Header.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
sender - is the server the sender
time - is the time to associate with the message.

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              boolean sender)
Log a message into the log directory. Status information is extracted from SIPExtension header. The time associated with the message is the current time.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
sender - is the server the sender

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              String status,
                              boolean sender,
                              String time)
Log a message into the log directory.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
status - the status to log. This is appended to any NISTExtension header present in the message.
sender - is the server the sender or receiver (true if sender).
time - is the reception time.

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              String status,
                              boolean sender,
                              long time)
Log a message into the log directory.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
status - the status to log. This is appended to any NISTExtension header present in the message.
sender - is the server the sender or receiver (true if sender).
time - is the reception time.

logMessage

public static void logMessage(gov.nist.javax.sip.message.SIPMessage message,
                              String from,
                              String to,
                              String status,
                              boolean sender)
Log a message into the log directory. Time stamp associated with the message is the current time.

Parameters:
message - a SIPMessage to log
from - from header of the message to log into the log directory
to - to header of the message to log into the log directory
status - the status to log.
sender - is the server the sender or receiver (true if sender).

traceMsg

public static void traceMsg(int msgLevel,
                            String tracemsg)
Log a message into the log file.

Parameters:
msgLevel - Logging level for this message.
tracemsg - message to write out.

logException

public static void logException(Exception ex)
Log an exception stack trace.

Parameters:
ex - Exception to log into the log file

setLogName

public static void setLogName(String name)
Set the name to assign for the log.


initMessageLogTable

public static void initMessageLogTable(String stackAddress,
                                       int rmiPort,
                                       String rootName,
                                       int traceLifeTime)
                                throws RemoteException
Initialize the table for RMI access to the log file. Call this function when the stack initializes to allow remote access to the message log.

Parameters:
rmiPort - is the RMI registry port.
RemoteException

getMessageLogTable

public static gov.nist.javax.sip.stack.MessageLogTableImpl getMessageLogTable()
Return the message log table.

Returns:
the messageLogTable member.

println

public static void println(String s)
print a line to stdout if the traceLevel is TRACE_DEBUG.

Parameters:
s - String to print out.

setTraceLevel

public static void setTraceLevel(int level)
Set the trace level for the stack.

Parameters:
level - -- the trace level to set. The following trace levels are supported:
  • 0 -- no tracing
  • 16 -- trace messages only
  • 32 Full tracing including debug messages.

getTraceLevel

public static int getTraceLevel()
Get the trace level for the stack.

Returns:
the trace level

setRemoteRepository

public static void setRemoteRepository(String repositoryName)
Set the remote repository name.


setAuxInfo

public static void setAuxInfo(String auxInfo)
Set aux information. Auxiliary information may be associated with the log file. This is useful for remote logs.

Parameters:
auxInfo - -- auxiliary information.

setDescription

public static void setDescription(String desc)
Set the descriptive String for the log.

Parameters:
desc - is the descriptive string.

commitRemoteLog

public static void commitRemoteLog()
Commit the log information to the remote repository. Fails silently if unable to commit the remote log or if the remoteRepository pointer is not set.


NIST SIP Parser and Stack (v1.2) API

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Get the latest distribution.
Submit a bug report or feature request.