NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip.stack
Class ServerLog

java.lang.Object
  extended bygov.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:
1.2 $Revision: 1.20 $ $Date: 2006/08/15 21:44:53 $
Author:
M. Ranganathan

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(SIPTransactionStack sipStack, Properties configurationProperties)
           
 
Method Summary
 void checkLogFile()
           
 String getLogFileName()
          return the name of the log file.
 int getTraceLevel()
          Get the trace level for the stack.
 void logException(Exception ex)
          Log an exception stack trace.
 void logMessage(SIPMessage message, String from, String to, boolean sender, long time)
          Log a message into the log directory.
 void logMessage(SIPMessage message, String from, String to, boolean sender, String time)
          Log a message into the log directory.
 void logMessage(SIPMessage message, String from, String to, String status, boolean sender)
          Log a message into the log directory.
 void logMessage(SIPMessage message, String from, String to, String status, boolean sender, long time)
          Log a message into the log directory.
 void logMessage(SIPMessage message, String from, String to, String status, boolean sender, String time)
          Log a message into the log directory.
 boolean needsLogging()
          Global check for whether to log or not.
 boolean needsLogging(int logLevel)
          Check to see if logging is enabled at a level (avoids unecessary message formatting.
 void println(String s)
          print a line to stdout if the traceLevel is TRACE_DEBUG.
 void setAuxInfo(String auxInfo)
          Set aux information.
 void setLogFileName(String name)
          Set the log file name
 void setStackIpAddress(String ipAddress)
           
 void setTraceLevel(int level)
          Set the trace level for the stack.
 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 final int TRACE_NONE
Dont trace

See Also:
Constant Field Values

TRACE_MESSAGES

public static final int TRACE_MESSAGES
See Also:
Constant Field Values

TRACE_EXCEPTION

public static final int TRACE_EXCEPTION
Trace exception processing

See Also:
Constant Field Values

TRACE_DEBUG

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

See Also:
Constant Field Values
Constructor Detail

ServerLog

public ServerLog(SIPTransactionStack sipStack,
                 Properties configurationProperties)
Method Detail

setStackIpAddress

public void setStackIpAddress(String ipAddress)

checkLogFile

public void checkLogFile()

needsLogging

public 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 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 void setLogFileName(String name)
Set the log file name

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

getLogFileName

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


logMessage

public void logMessage(SIPMessage message,
                       String from,
                       String to,
                       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
sender - is the server the sender
time - is the time to associate with the message.

logMessage

public void logMessage(SIPMessage message,
                       String from,
                       String to,
                       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
sender - is the server the sender
time - is the time to associate with the message.

logMessage

public void logMessage(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.
sender - is the server the sender or receiver (true if sender).
time - is the reception time.

logMessage

public void logMessage(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.
sender - is the server the sender or receiver (true if sender).
time - is the reception time.

logMessage

public void logMessage(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 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 void logException(Exception ex)
Log an exception stack trace.

Parameters:
ex - Exception to log into the log file

println

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

Parameters:
s - String to print out.

setTraceLevel

public 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 int getTraceLevel()
Get the trace level for the stack.

Returns:
the trace level

setAuxInfo

public 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.

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

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