|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.log.TWGLog
This class provides logging function that allows multiple processes to write log messages into shared log files. This function is used primarily for RAS logging by most of Director's components, but it is also used to log operational status messages by the scheduler and scheduled tasks. Most of the work done by this class is implemented in native methods. In the current Windows NT environment of Director's server, there are three binaries that are used:
Field Summary | |
---|---|
static int |
defaultBufferSize
|
static int |
defaultFileSize
|
static int |
TARGET_JAVA
|
static int |
TARGET_JNI
|
static int |
TARGET_SYSOUT
|
Constructor Summary | |
---|---|
TWGLog(java.lang.String logName)
Constructor specifying only the name of the log. |
|
TWGLog(java.lang.String logName,
boolean useLogDir)
Constructor specifying the name of the log and if the file should be created in the \log directory. |
|
TWGLog(java.lang.String logName,
long categories,
int level)
Constructor specifying categories and level. |
|
TWGLog(java.lang.String logName,
long categories,
int level,
int maxFileSize,
int bufferSize)
Constructor specifying all log parameters |
Method Summary | |
---|---|
static long |
attachListener(TWGLogListener listener,
java.lang.String logName)
Attach a listener to a specified log. |
static long |
attachListener(TWGLogListener listener,
java.lang.String logName,
boolean isRas)
Attach a listener to a specified log. |
static java.lang.String |
byteArrayToHexString(java.lang.String label,
byte[] array,
int offset)
|
void |
clearAllMessages()
|
void |
close()
|
void |
closeDefine()
|
void |
define(java.lang.String key,
java.lang.String value)
|
void |
define(java.lang.String key,
java.lang.String bundleName,
java.lang.String bundleKey)
|
static void |
delete(java.lang.String logName)
|
static void |
detachListener(int listenerHandle)
Remove a listener from a log. |
void |
formatDebug(long component,
java.lang.String message)
Formats a RAS debug message. |
void |
formatDebug(long component,
java.lang.String message,
java.lang.Throwable e)
|
void |
formatDebugH(long component,
java.lang.String message)
|
void |
formatDebugH(long component,
java.lang.String message,
java.lang.Throwable e)
|
void |
formatDump(long component,
java.lang.String message,
byte[] data,
int dataLength)
Formats a RAS dump message. |
void |
formatDumpH(long component,
java.lang.String message,
byte[] data,
int dataLength)
|
void |
formatEntry(long component,
java.lang.String message)
Formats a RAS method entry trace message. |
void |
formatEntryExit(long component,
java.lang.String message)
Formats a RAS method entry/exit trace message. |
void |
formatEntryExitH(long component,
java.lang.String message)
|
void |
formatEntryH(long component,
java.lang.String message)
|
void |
formatError(long component,
java.lang.String message)
Formats a RAS error message. |
void |
formatError(long component,
java.lang.String message,
java.lang.Throwable e)
|
void |
formatExit(long component,
java.lang.String message)
Formats a RAS method exit trace message. |
void |
formatExitH(long component,
java.lang.String message)
|
long |
getCategories()
Get this log's category mask. |
long |
getComponents()
Get the RAS log's component mask |
int |
getLevel()
Get this log's level. |
TWGLogImpl |
getLogImpl()
|
int |
getMaxFileSize()
Get the maximum size the log engine will allow the log file for this log to grow before rolling it over to a back-up file and starting a new log file. |
java.lang.String |
getName()
Get the name of this log. |
static TWGRasLogger |
getRasLoggerInstance(java.lang.String logName)
|
static int |
getTarget()
|
int |
getTypes()
Get the RAS log's type mask |
static void |
initialize()
|
static void |
initialize(int initializer)
Initializes the log engine by starting it in a new process |
static java.lang.String |
intArrayToHexString(java.lang.String label,
int[] array,
int offset)
|
static java.lang.String |
intArrayToString(java.lang.String label,
int[] array)
|
boolean |
isLoggable(long category,
int level)
See if a message is loggable based on this log's component and level setting. |
long |
lastServiced()
Get the time of when the log engine last serviced this log |
long |
lastWrapped()
Get the time of when the log engine last wrapped this log |
boolean |
openDefine()
|
void |
setCategory(long category)
Add one or more categories to this log's category mask. |
void |
setComponent(long newComponents)
Add one or more components to the RAS log's component mask. |
void |
setLevel(int level)
Set this log's level. |
void |
setMaxFileSize(int maxFileSize)
Set the maximum size the log engine will allow the log file for this log to grow before rolling it over to a back-up file and starting a new log file. |
static void |
setTarget(int t)
|
void |
setType(int newTypes)
Add one or more types to the RAS log's type mask. |
void |
term()
|
static void |
terminate()
Terminate the log engine by killing the process |
boolean |
traceOn(long component,
int types)
Determine if a RAS message should be logged based on the component and type masks. |
void |
unsetCategory(long category)
Remove one or more categories from this log's category mask. |
void |
unsetComponent(long delComponents)
Remove one or more components from the RAS log's component mask. |
void |
unsetType(int delTypes)
Remove one or more types from the RAS log's type mask. |
void |
updateParms()
|
void |
write(java.lang.String message,
long category,
int level)
Conditionally write a message to a log. |
void |
write(java.lang.String message,
long category,
int level,
int correlator)
Conditionally write a correlated message to a log. |
void |
writeAll(java.lang.String message,
long category,
int level)
Unconditionally write a message to a log. |
void |
writeAll(java.lang.String message,
long category,
int level,
int correlator)
Unconditionally write a correlated message to a log. |
static void |
writeDefault(java.lang.String message,
long category,
int level)
Conditionally write a message to the default log. |
static void |
writeDefault(java.lang.String message,
long category,
int level,
int correlator)
Conditionally write a correlated message to the default log. |
static void |
writeDefaultAll(java.lang.String message,
long category,
int level)
Unconditionally write a message to the default log. |
static void |
writeDefaultAll(java.lang.String message,
long category,
int level,
int correlator)
Unconditionally write a correlated message to the default log. |
void |
writeNLS(java.lang.String bundleName,
java.lang.String messageKey,
int level)
Conditionally write a NLS message to a log. |
void |
writeNLS(java.lang.String bundleName,
java.lang.String messageKey,
int level,
int correlator)
Conditionally write a NLS message to a log. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int defaultFileSize
public static final int defaultBufferSize
public static final int TARGET_JAVA
public static final int TARGET_SYSOUT
public static final int TARGET_JNI
Constructor Detail |
public TWGLog(java.lang.String logName, long categories, int level, int maxFileSize, int bufferSize)
logName
- The name of the log. Don't include any extensions,
for example ("TWGRas").categories
- The initial value for the categories mask
(for RAS logs, this is the component mask)level
- The initial value for the level mask.
(for RAS logs, this is the type mask)maxFileSize
- The maximum size to allow the log file to grow before
it is renamed to logName.bak and reopened. So,
the maximum amount of log data ranges from
maxFileSize to 2*maxFileSize.bufferSize
- The size of the memory buffer used to store log
messages prior to writing them out to disk.public TWGLog(java.lang.String logName, long categories, int level)
logName
- The name of the log. Don't include any extensions,
for example ("TWGRas").categories
- The initial value for the categories mask
(for RAS logs, this is the component mask)level
- The initial value for the level mask.
(for RAS logs, this is the type mask)public TWGLog(java.lang.String logName, boolean useLogDir)
logName
- The name of the log. Don't include any extensions,
for example ("TWGRas").useLogDir
- Should the created logfile be placed in the \log directory.public TWGLog(java.lang.String logName)
logName
- The name of the log. Don't include any extensions,
for example ("TWGRas").Method Detail |
public static int getTarget()
public static void setTarget(int t)
public TWGLogImpl getLogImpl()
public static void initialize()
public static void delete(java.lang.String logName)
public void close()
public void updateParms()
updateParms
in interface TWGRasLogger
public void term()
term
in interface TWGRasLogger
public static void initialize(int initializer)
initializer
- this integer should be set to TWGRas.INIT_ENGINE,
TWGRas.INIT_CONSOLE, TWGRas.INIT_NONE depending on if
it this initialization is being called by code running in
the engine's JVM, the console's JVM or some other JVM.
If the INIT_ENGINE is specified, it causes the server
engine's config properties to be used for the log
engine launch command and its parameters.
Temporarily, INIT_CONSOLE simply causes the useNative flag
to be set to false.public static void terminate()
public static TWGRasLogger getRasLoggerInstance(java.lang.String logName)
public final java.lang.String getName()
public final int getMaxFileSize()
public final void setMaxFileSize(int maxFileSize)
setMaxFileSize
in interface TWGRasLogger
maxFileSize
- The maximum size to allow the log file to grow before
it is renamed to logName.bak and reopened. So,
the maximum amount of log data ranges from
maxFileSize to 2*maxFileSize.public final boolean isLoggable(long category, int level)
category
- The category to be testedlevel
- The level to be testedpublic final void write(java.lang.String message, long category, int level)
message
- message textcategory
- category of the messagelevel
- level of the messagepublic final void write(java.lang.String message, long category, int level, int correlator)
message
- message textcategory
- category of the messagelevel
- level of the messagecorrelator
- correlator for this messagepublic void writeNLS(java.lang.String bundleName, java.lang.String messageKey, int level, int correlator)
messageKey
- key of message in resource bundlelevel
- level of the messagecorrelator
- correlator for the messagepublic void writeNLS(java.lang.String bundleName, java.lang.String messageKey, int level)
messageKey
- key of message in resource bundlelevel
- level of the messagepublic final void writeAll(java.lang.String message, long category, int level)
message
- message textcategory
- category of the messagelevel
- level of the messagepublic final void writeAll(java.lang.String message, long category, int level, int correlator)
message
- message textcategory
- category of the messagelevel
- level of the messagecorrelator
- correlator for this messagepublic final boolean openDefine()
public final void define(java.lang.String key, java.lang.String value)
public final void define(java.lang.String key, java.lang.String bundleName, java.lang.String bundleKey)
public final void closeDefine()
public static final void writeDefault(java.lang.String message, long category, int level)
message
- message textcategory
- category of the messagelevel
- level of the messagepublic static final void writeDefault(java.lang.String message, long category, int level, int correlator)
message
- message textcategory
- category of the messagelevel
- level of the messagecorrelator
- correlator for this messagepublic static final void writeDefaultAll(java.lang.String message, long category, int level)
message
- message textcategory
- category of the messagelevel
- level of the messagepublic static final void writeDefaultAll(java.lang.String message, long category, int level, int correlator)
message
- message textcategory
- category of the messagelevel
- level of the messagecorrelator
- correlator for this messagepublic final void setCategory(long category)
category
- one or more categories to be ORed into this log's
category maskpublic final void unsetCategory(long category)
category
- one or more categories to be ANDed out of this log's
category maskpublic final long getCategories()
public final void setLevel(int level)
level
- new value for this log's levelpublic final int getLevel()
public static final long attachListener(TWGLogListener listener, java.lang.String logName)
listener
- reference to the object implementing the TWGLogListener
interface that will be called when a new message is
added to the log.logName
- name of the log to be listened to (for example, "TWGRas")public static final long attachListener(TWGLogListener listener, java.lang.String logName, boolean isRas)
listener
- reference to the object implementing the TWGLogListener
interface that will be called when a new message is
added to the log.logName
- name of the log to be listened to (for example, "TWGRas")public static final void detachListener(int listenerHandle)
listenerHandle
- handle returned from TWGLog.attachListener()public final void formatEntry(long component, java.lang.String message)
formatEntry
in interface TWGRasLogger
component
- component making the flow trace callmessage
- message to put in RAS logTWGRasLogger
public final void formatEntryH(long component, java.lang.String message)
formatEntryH
in interface TWGRasLogger
public final void formatEntryExit(long component, java.lang.String message)
formatEntryExit
in interface TWGRasLogger
component
- component making the flow trace callmessage
- message to put in RAS logTWGRasLogger
public final void formatEntryExitH(long component, java.lang.String message)
formatEntryExitH
in interface TWGRasLogger
public final void formatExit(long component, java.lang.String message)
formatExit
in interface TWGRasLogger
component
- component making the flow trace callmessage
- message to put in RAS logTWGRasLogger
public final void formatExitH(long component, java.lang.String message)
formatExitH
in interface TWGRasLogger
public final void formatDebug(long component, java.lang.String message)
formatDebug
in interface TWGRasLogger
component
- component making the flow trace callmessage
- message to put in RAS logTWGRasLogger
public final void formatDebug(long component, java.lang.String message, java.lang.Throwable e)
formatDebug
in interface TWGRasLogger
public final void formatDebugH(long component, java.lang.String message)
formatDebugH
in interface TWGRasLogger
public final void formatDebugH(long component, java.lang.String message, java.lang.Throwable e)
formatDebugH
in interface TWGRasLogger
public final void formatError(long component, java.lang.String message)
formatError
in interface TWGRasLogger
component
- component making the flow trace callmessage
- message to put in RAS logTWGRasLogger
public final void formatError(long component, java.lang.String message, java.lang.Throwable e)
formatError
in interface TWGRasLogger
public static java.lang.String intArrayToHexString(java.lang.String label, int[] array, int offset)
public static java.lang.String byteArrayToHexString(java.lang.String label, byte[] array, int offset)
public static java.lang.String intArrayToString(java.lang.String label, int[] array)
public final void formatDump(long component, java.lang.String message, byte[] data, int dataLength)
formatDump
in interface TWGRasLogger
component
- component making the dump callmessage
- descriptive message for the data area being dumpeddataLength
- length of data area to be dumpeddata
- data area to be dumpedTWGRasLogger
public final void formatDumpH(long component, java.lang.String message, byte[] data, int dataLength)
formatDumpH
in interface TWGRasLogger
public final boolean traceOn(long component, int types)
traceOn
in interface TWGRasLogger
component
- component(s) to test
TWGRasLogger
public final long getComponents()
getComponents
in interface TWGRasLogger
TWGRasLogger
public final void setComponent(long newComponents)
setComponent
in interface TWGRasLogger
newComponents
- component(s) to be ORed into the RAS log's component maskTWGRasLogger
public final void unsetComponent(long delComponents)
unsetComponent
in interface TWGRasLogger
delComponents
- component(s) to be ANDed out of the RAS log's component maskTWGRasLogger
public final int getTypes()
getTypes
in interface TWGRasLogger
TWGRasLogger
public final long lastServiced()
public final long lastWrapped()
public final void setType(int newTypes)
setType
in interface TWGRasLogger
newTypes
- type(s) to be ORed into the RAS log's type maskTWGRasLogger
public final void unsetType(int delTypes)
unsetType
in interface TWGRasLogger
delTypes
- type(s) to be ANDed out of the RAS log's type maskTWGRasLogger
public final void clearAllMessages()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |