com.tivoli.twg.log
Class TWGLogMsg

java.lang.Object
  extended bycom.tivoli.twg.log.TWGLogMsg

public class TWGLogMsg
extends java.lang.Object

A class which gives a structure for passing a log message to a TWGLogListener callback method.


Field Summary
protected  long category
           
protected  int correlator
           
protected  int level
           
protected  java.lang.String text
           
protected  java.util.Date timeStamp
           
 
Constructor Summary
protected TWGLogMsg()
           
  TWGLogMsg(byte[] buf)
           
  TWGLogMsg(long Category, int Level, int Correlator, int time_t, short msec, java.lang.String Text)
          Constructor for creating a log message.
  TWGLogMsg(java.io.RandomAccessFile fin)
           
  TWGLogMsg(TWGByteArrayInputStr sin, java.util.Locale loc, java.util.Properties defs)
           
 
Method Summary
static void addResourceBundle(java.lang.String bundleName, java.util.ResourceBundle bundle)
           
 long category()
          Get this message's category.
static boolean checkLocation(java.io.RandomAccessFile fin, long offset, long time)
           
 int correlator()
          Get the message's correlator value.
 int level()
          Get this message's level.
 void readTWGByteArray(TWGByteArrayInputStr sin)
           
static void setDateFormat(java.text.DateFormat newDateFormat)
           
static void setDateFormat(java.lang.String pattern, java.util.Locale loc)
           
static void setDefaultDateFormat()
           
 java.lang.String text()
          Get this message's text.
 java.util.Date timeStamp()
          Get this message's timestamp.
 byte[] toByteArray()
           
 byte[] toByteArray(boolean prepend4)
           
 java.lang.String toString()
          Turn this log message into a string
 void writeToFile(java.io.RandomAccessFile raf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

category

protected long category

level

protected int level

correlator

protected int correlator

timeStamp

protected java.util.Date timeStamp

text

protected java.lang.String text
Constructor Detail

TWGLogMsg

protected TWGLogMsg()

TWGLogMsg

public TWGLogMsg(long Category,
                 int Level,
                 int Correlator,
                 int time_t,
                 short msec,
                 java.lang.String Text)
Constructor for creating a log message.

Parameters:
Category - The category of the log message. The category is specific to each log. Note: for RAS logs, the message type is one of the component contents defined in TWGRas.java
Level - The level of severity/detail for the message. The lower the number the more severe/more general the message. By setting the logs level to a lower number, less severe or more detailed messages can be filtered out. Note: for RAS logs, the level actuall represents the RAS message type identified by one of the constants in TWGRas.java.
Correlator - A value used to link together messages that are related to a single event. Use zero if this field is not significant.
time_t - The number of seconds since 1-1-70 (i.e. time() from the C run-time library).
msec - The milliseconds part of the timestamp.
Text - The message's text.

TWGLogMsg

public TWGLogMsg(java.io.RandomAccessFile fin)
          throws java.io.IOException

TWGLogMsg

public TWGLogMsg(TWGByteArrayInputStr sin,
                 java.util.Locale loc,
                 java.util.Properties defs)
          throws java.io.UTFDataFormatException

TWGLogMsg

public TWGLogMsg(byte[] buf)
          throws java.io.UTFDataFormatException
Method Detail

checkLocation

public static boolean checkLocation(java.io.RandomAccessFile fin,
                                    long offset,
                                    long time)

readTWGByteArray

public void readTWGByteArray(TWGByteArrayInputStr sin)
                      throws java.io.UTFDataFormatException
Throws:
java.io.UTFDataFormatException

category

public final long category()
Get this message's category. For RAS messages, this is the trace type (i.e entry, exit, dump, etc.).

Returns:
This message's category/trace type

level

public final int level()
Get this message's level. This field is not used for RAS messages, so it will always return 0.

Returns:
This message's level

correlator

public final int correlator()
Get the message's correlator value.

Returns:
This message's correlator

timeStamp

public final java.util.Date timeStamp()
Get this message's timestamp.

Returns:
This message's timestamp

text

public final java.lang.String text()
Get this message's text.

Returns:
This message's text

toString

public java.lang.String toString()
Turn this log message into a string


toByteArray

public byte[] toByteArray()

toByteArray

public byte[] toByteArray(boolean prepend4)

writeToFile

public void writeToFile(java.io.RandomAccessFile raf)
                 throws java.io.IOException
Throws:
java.io.IOException

setDefaultDateFormat

public static void setDefaultDateFormat()

setDateFormat

public static void setDateFormat(java.lang.String pattern,
                                 java.util.Locale loc)

setDateFormat

public static void setDateFormat(java.text.DateFormat newDateFormat)

addResourceBundle

public static void addResourceBundle(java.lang.String bundleName,
                                     java.util.ResourceBundle bundle)