com.ibm.etools.logging.util
Class DefaultRecord

java.lang.Object
  |
  +--com.ibm.etools.logging.util.DefaultRecord

public class DefaultRecord
extends java.lang.Object

Preferred Programming Model:

It's not recommended to instantiate a new 'DefaultRecord' object for every log record being passed to a logger. This can heavily affect the overall performance of the application. The following section gives a brief overview of the recommended usage of 'DefaultRecord':

Recommendations:

Avoid:

Note: When creating new DefaultRecords using one of its constructors, the threadName property is automatically set to the name of the tread in which the DefaultRecord was created and NOT the thread in which the DefaultRecord will be logged. Users desiring to create one reusable DefaultRecord should either a) create a DefaultRecord for each thread in which a DefaultRecord will be logged and/or b) update the DefaultRecord's threadName property before it is logged using the property's setter API (e.g. setThreadName(String newThreadName)).

-------------------------------------------------------------------------
Licensed Material - Property of IBM
 
(C) Copyright IBM Corp. 2003, 2005  - All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure
restricted by GSA ADP Schedule Contract with IBM Corp.

This class is a wrapper of an instance of MsgLogger, where each of the static
methods are delegated to this instance.

CHANGE HISTORY

Date      Programmer           Defect   Description
--------  -----------------    ------   --------------------------------
11/08/00  mfaraj@ca.ibm.com             initial creation
07/01/02  paules@ca.ibm.com    188507   Added DefaultRecord() and support setSourceClassName
03/07/03  amehrega@ca.ibm.com  189572   Provide convenience methods for specifying class name
03/07/03  amehrega@ca.ibm.com  189575   Provide guidelines for creating a new DefaultRecord


Constructor Summary
DefaultRecord()
           
DefaultRecord(java.lang.String message, int loggingLevel)
           
DefaultRecord(java.lang.String message, int loggingLevel, boolean update)
          Convenience contructor, for setting a message at different logging levels.
DefaultRecord(java.lang.String componentName, java.lang.Object sourceClassObject, java.lang.String sourceMethodName, int severity, java.lang.String message)
           
DefaultRecord(java.lang.String componentName, java.lang.Object sourceClassObject, java.lang.String sourceMethodName, java.lang.String messageID, int severity, java.lang.String message, SubstitutionVariable[] substitutionVariables)
           
DefaultRecord(java.lang.String componentName, java.lang.Object sourceClassObject, java.lang.String sourceMethodName, java.lang.String messageID, int severity, SubstitutionVariable[] substitutionVariables)
           
DefaultRecord(java.lang.String product, java.lang.String version, java.lang.String componentName, java.lang.Object sourceClass, java.lang.String sourceMethodName, java.lang.String messageID, int newSeverity, java.lang.String message, SubstitutionVariable[] substitutionVariables)
           
 
Method Summary
 java.lang.String getComponentName()
           
 java.lang.String getDate()
           
 java.lang.String getHostAddress()
           
 java.lang.String getHostName()
           
 java.lang.String getMessage()
           
 java.lang.String getMessageID()
           
 SubstitutionVariable[] getMessageVars()
           
 long getMillis()
           
 java.lang.String getProduct()
           
 long getSequenceNumber()
           
 int getSeverity()
           
 java.lang.String getSourceClassName()
           
 java.lang.String getSourceMethodName()
           
 java.lang.String getThreadName()
           
 java.lang.String getVersion()
           
 void logInfo(java.lang.String message)
           
 void logInfo(java.lang.String message, boolean update)
          Covenience method used for quick logging.
 void logSevere(java.lang.String message)
           
 void logSevere(java.lang.String message, boolean update)
          Covenience method used for quick logging.
 void logWarning(java.lang.String message)
           
 void logWarning(java.lang.String message, boolean update)
          Covenience method used for quick logging.
 void setComponentName(java.lang.String newComponentName)
           
 void setDate(java.lang.String newDate)
           
 void setHostAddress(java.lang.String newHostAddress)
           
 void setHostName(java.lang.String newHostName)
           
 void setMessage(java.lang.String newMessage)
           
 void setMessageID(java.lang.String newMessageID)
           
 void setMessageVars(SubstitutionVariable[] newsubstitutionVariables)
           
 void setMillis(long newMillis)
           
 void setProduct(java.lang.String newProduct)
           
 void setSequenceNumber(long newSequenceNumber)
           
 void setSeverity(int newSeverity)
          Set the level of logging to one of the eight levels (i.e.
 void setSourceClassName(java.lang.Object newSourceClass)
           
 void setSourceMethodName(java.lang.String newSourceMethodName)
           
 void setThreadName(java.lang.String newThreadName)
           
 void setVersion(java.lang.String newVersion)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRecord

public DefaultRecord()

DefaultRecord

public DefaultRecord(java.lang.String product,
                     java.lang.String version,
                     java.lang.String componentName,
                     java.lang.Object sourceClass,
                     java.lang.String sourceMethodName,
                     java.lang.String messageID,
                     int newSeverity,
                     java.lang.String message,
                     SubstitutionVariable[] substitutionVariables)

DefaultRecord

public DefaultRecord(java.lang.String componentName,
                     java.lang.Object sourceClassObject,
                     java.lang.String sourceMethodName,
                     java.lang.String messageID,
                     int severity,
                     java.lang.String message,
                     SubstitutionVariable[] substitutionVariables)

DefaultRecord

public DefaultRecord(java.lang.String componentName,
                     java.lang.Object sourceClassObject,
                     java.lang.String sourceMethodName,
                     int severity,
                     java.lang.String message)

DefaultRecord

public DefaultRecord(java.lang.String componentName,
                     java.lang.Object sourceClassObject,
                     java.lang.String sourceMethodName,
                     java.lang.String messageID,
                     int severity,
                     SubstitutionVariable[] substitutionVariables)

DefaultRecord

public DefaultRecord(java.lang.String message,
                     int loggingLevel,
                     boolean update)
Convenience contructor, for setting a message at different logging levels.

Parameters:
message - - The string message to be logged loggingLevel - Will set severity to SEVERE if 0, WARNING if 1, and INFO otherwise update - If true, then millis, date, and thread name will get updated; otherwise these fields are not updated.

DefaultRecord

public DefaultRecord(java.lang.String message,
                     int loggingLevel)
Method Detail

logSevere

public void logSevere(java.lang.String message,
                      boolean update)
Covenience method used for quick logging. 'message' is assigned at logging level = SEVERE

Parameters:
message - - The string message to be logged

logSevere

public void logSevere(java.lang.String message)

logWarning

public void logWarning(java.lang.String message,
                       boolean update)
Covenience method used for quick logging. 'message' is assigned at logging level = WARNING

Parameters:
message - - The string message to be logged

logWarning

public void logWarning(java.lang.String message)

logInfo

public void logInfo(java.lang.String message,
                    boolean update)
Covenience method used for quick logging. 'message' is assigned at logging level = INFO

Parameters:
message - - The string message to be logged

logInfo

public void logInfo(java.lang.String message)

getComponentName

public java.lang.String getComponentName()

getMessageID

public java.lang.String getMessageID()

getMessage

public java.lang.String getMessage()

getMillis

public long getMillis()

getThreadName

public java.lang.String getThreadName()

getSequenceNumber

public long getSequenceNumber()

getSourceClassName

public java.lang.String getSourceClassName()

getSourceMethodName

public java.lang.String getSourceMethodName()

getSeverity

public int getSeverity()

getDate

public java.lang.String getDate()

getProduct

public java.lang.String getProduct()

getVersion

public java.lang.String getVersion()

getHostName

public java.lang.String getHostName()

getHostAddress

public java.lang.String getHostAddress()

getMessageVars

public SubstitutionVariable[] getMessageVars()

setComponentName

public void setComponentName(java.lang.String newComponentName)

setMessageID

public void setMessageID(java.lang.String newMessageID)

setMessage

public void setMessage(java.lang.String newMessage)

setMillis

public void setMillis(long newMillis)

setThreadName

public void setThreadName(java.lang.String newThreadName)

setSequenceNumber

public void setSequenceNumber(long newSequenceNumber)

setSourceClassName

public void setSourceClassName(java.lang.Object newSourceClass)

setSourceMethodName

public void setSourceMethodName(java.lang.String newSourceMethodName)

setSeverity

public final void setSeverity(int newSeverity)
                       throws java.lang.IllegalArgumentException
Set the level of logging to one of the eight levels (i.e. LEVEL.FINEST - Level.NONE).

Parameters:
newSeverity - new level of logging (i.e. LEVEL.FINEST - Level.NONE)
Throws:
java.lang.IllegalArgumentException - Attempting to set an illegal level

setDate

public void setDate(java.lang.String newDate)

setProduct

public void setProduct(java.lang.String newProduct)

setVersion

public void setVersion(java.lang.String newVersion)

setHostName

public void setHostName(java.lang.String newHostName)

setHostAddress

public void setHostAddress(java.lang.String newHostAddress)

setMessageVars

public void setMessageVars(SubstitutionVariable[] newsubstitutionVariables)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object