com.tivoli.twg.libs
Class TWGOpSysEvent

java.lang.Object
  extended bycom.tivoli.twg.libs.TWGOpSysEvent

public class TWGOpSysEvent
extends java.lang.Object

Native class for defining optional interfaces for logging JVM events to operating system specific event logs. This class will always log the events to an application-specific event file (which is cleared when the application is started again), but can also log events to operating system specific logs through a JNI of several methods). If the JNI methods are not found, the class will just add the events to the applications event file. The JNI methods are not required for all platforms.


Constructor Summary
TWGOpSysEvent()
           
 
Method Summary
static void dumpJVMMonitors()
          Dump monitor state to stderr : uses JVM-specific functions, if available, otherwise do nothing
static void dumpJVMThreads()
          Dump thread state to stderr : uses JVM-specific functions, if available, otherwise just enumerates threads
static java.lang.String getAppVersion()
          Get version string appended to application name in error log entries
static void logApplicationError(java.lang.String app, int errcode, java.lang.String errmsg)
          Primary method for logging application error codes
static void logApplicationError(java.lang.String app, int errcode, java.lang.String errmsg, java.lang.Throwable excpt)
          Primary method for logging application error codes
static void logUnhandledException(java.lang.String app, java.lang.Thread thrd, java.lang.Throwable excpt)
          Primary method for logging unhandled exceptions as errors
static void main(java.lang.String[] args)
          Command line interface for testing
static void nativeDumpJVMMonitors()
          Dump monitor state to stderr : uses JVM-specific functions, if available, otherwise do nothing
static void nativeDumpJVMThreads()
          Dump thread state to stderr : uses JVM-specific functions, if available, otherwise just enumerates threads
static void setAppVersion(java.lang.String verstr)
          Set version string appended to application name in error log entries
static void setErrorHandler(TWGErrorHandler eh)
          Set error handler
static void setLogDirectory(java.lang.String logdir)
          Set output directory for error logs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TWGOpSysEvent

public TWGOpSysEvent()
Method Detail

logUnhandledException

public static void logUnhandledException(java.lang.String app,
                                         java.lang.Thread thrd,
                                         java.lang.Throwable excpt)
Primary method for logging unhandled exceptions as errors

Parameters:
app - - application name
thrd - - thread throwing exception
excpt - - exception thrown

logApplicationError

public static void logApplicationError(java.lang.String app,
                                       int errcode,
                                       java.lang.String errmsg)
Primary method for logging application error codes

Parameters:
app - - application name
errcode - - error code
errmsg - - error message

logApplicationError

public static void logApplicationError(java.lang.String app,
                                       int errcode,
                                       java.lang.String errmsg,
                                       java.lang.Throwable excpt)
Primary method for logging application error codes

Parameters:
app - - application name
errcode - - error code
errmsg - - error message
excpt - - exception

dumpJVMThreads

public static void dumpJVMThreads()
Dump thread state to stderr : uses JVM-specific functions, if available, otherwise just enumerates threads


nativeDumpJVMThreads

public static void nativeDumpJVMThreads()
Dump thread state to stderr : uses JVM-specific functions, if available, otherwise just enumerates threads


dumpJVMMonitors

public static void dumpJVMMonitors()
Dump monitor state to stderr : uses JVM-specific functions, if available, otherwise do nothing


nativeDumpJVMMonitors

public static void nativeDumpJVMMonitors()
Dump monitor state to stderr : uses JVM-specific functions, if available, otherwise do nothing


setLogDirectory

public static void setLogDirectory(java.lang.String logdir)
Set output directory for error logs

Parameters:
logdir - - log directory

setAppVersion

public static void setAppVersion(java.lang.String verstr)
Set version string appended to application name in error log entries

Parameters:
verstr - version string to set (or null to set default)

getAppVersion

public static java.lang.String getAppVersion()
Get version string appended to application name in error log entries

Returns:
version string

main

public static void main(java.lang.String[] args)
Command line interface for testing


setErrorHandler

public static void setErrorHandler(TWGErrorHandler eh)
Set error handler

Parameters:
eh - implementor of the TWGErrorHandler interface to set