org.safs.staf.service.logging
Class SAFSCustomLoggingService

java.lang.Object
  extended by org.safs.staf.service.logging.SAFSCustomLoggingService
All Implemented Interfaces:
com.ibm.staf.service.STAFServiceInterfaceLevel3

public class SAFSCustomLoggingService
extends java.lang.Object
implements com.ibm.staf.service.STAFServiceInterfaceLevel3

SAFSCustomLoggingService is an external STAF service that handles custom SAFS logging.

This class and CustomLogFac provide a sample implementation of custom logging service that writes directly to the same STAF logs that standard logging service writes to.

Registration of this service takes the following format:

SERVICE <ServiceName> LIBRARY JSTAF EXECUTE <ServiceJarFile> PARMS SAFSLOGGING <SAFSLoggingService>

SAFSLOGGING option is required because this service uses the unique STAF LOG service instance loaded by SAFS logging service to access the running STAF logs.

Example:

SERVICE SAFSCustomLogs LIBRARY JSTAF EXECUTE c:\staf\services\SAFSCustomLogs.jar PARMS SAFSLOGGING SAFSLogs

This service provides the following commands:

 INIT        <facname> MODE <mode> [LINKEDFAC <name>]
 LOGMESSAGE  <facname> MESSAGE <msg> [DESCRIPTION <desc>] [MSGTYPE <msgType>]
 CLOSE       <facname>
 HELP
 VERSION
 

See Also:
CustomLogFac, SAFSLoggingService, "SAFSLogs Service User's Guide"

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.staf.service.STAFServiceInterfaceLevel3
com.ibm.staf.service.STAFServiceInterfaceLevel3.InitInfo, com.ibm.staf.service.STAFServiceInterfaceLevel3.RequestInfo
 
Field Summary
static java.lang.String SCLS_SERVICE_OPTION_SAFSLOGGING
           
static java.lang.String SCLS_SERVICE_PARM_DESCRIPTION
           
static java.lang.String SCLS_SERVICE_PARM_LINKEDFAC
           
static java.lang.String SCLS_SERVICE_PARM_MESSAGE
           
static java.lang.String SCLS_SERVICE_PARM_MODE
           
static java.lang.String SCLS_SERVICE_PARM_MSGTYPE
           
static java.lang.String SCLS_SERVICE_REQUEST_CLOSE
           
static java.lang.String SCLS_SERVICE_REQUEST_HELP
           
static java.lang.String SCLS_SERVICE_REQUEST_INIT
           
static java.lang.String SCLS_SERVICE_REQUEST_LOGMESSAGE
           
static java.lang.String SCLS_SERVICE_REQUEST_VERSION
           
static java.lang.String SCLS_SERVICE_RESPONSE_BYPASS
           
 
Constructor Summary
SAFSCustomLoggingService()
           
 
Method Summary
 com.ibm.staf.STAFResult acceptRequest(com.ibm.staf.service.STAFServiceInterfaceLevel3.RequestInfo info)
          Handles service request from STAF.
static void debugPrintln(java.lang.String msg)
          Prints a line to the debug log if debugging is enabled.
static void debugPrintln(java.lang.String msg, java.lang.Exception e)
          Prints a message and Exception to the debug log if debugging is enabled.
static void debugPrintln(java.lang.String msg, com.ibm.staf.STAFResult r)
          Prints a message and STAFResult to the debug log if debugging is enabled.
 int init(com.ibm.staf.service.STAFServiceInterfaceLevel3.InitInfo info)
          Handles initializing this instance of the service for STAF.
 int term()
          Handles removing this service from STAF.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCLS_SERVICE_OPTION_SAFSLOGGING

public static final java.lang.String SCLS_SERVICE_OPTION_SAFSLOGGING
See Also:
Constant Field Values

SCLS_SERVICE_REQUEST_INIT

public static final java.lang.String SCLS_SERVICE_REQUEST_INIT
See Also:
Constant Field Values

SCLS_SERVICE_REQUEST_LOGMESSAGE

public static final java.lang.String SCLS_SERVICE_REQUEST_LOGMESSAGE
See Also:
Constant Field Values

SCLS_SERVICE_REQUEST_CLOSE

public static final java.lang.String SCLS_SERVICE_REQUEST_CLOSE
See Also:
Constant Field Values

SCLS_SERVICE_REQUEST_HELP

public static final java.lang.String SCLS_SERVICE_REQUEST_HELP
See Also:
Constant Field Values

SCLS_SERVICE_REQUEST_VERSION

public static final java.lang.String SCLS_SERVICE_REQUEST_VERSION
See Also:
Constant Field Values

SCLS_SERVICE_PARM_MODE

public static final java.lang.String SCLS_SERVICE_PARM_MODE
See Also:
Constant Field Values

SCLS_SERVICE_PARM_LINKEDFAC

public static final java.lang.String SCLS_SERVICE_PARM_LINKEDFAC
See Also:
Constant Field Values

SCLS_SERVICE_PARM_MESSAGE

public static final java.lang.String SCLS_SERVICE_PARM_MESSAGE
See Also:
Constant Field Values

SCLS_SERVICE_PARM_DESCRIPTION

public static final java.lang.String SCLS_SERVICE_PARM_DESCRIPTION
See Also:
Constant Field Values

SCLS_SERVICE_PARM_MSGTYPE

public static final java.lang.String SCLS_SERVICE_PARM_MSGTYPE
See Also:
Constant Field Values

SCLS_SERVICE_RESPONSE_BYPASS

public static final java.lang.String SCLS_SERVICE_RESPONSE_BYPASS
See Also:
Constant Field Values
Constructor Detail

SAFSCustomLoggingService

public SAFSCustomLoggingService()
Method Detail

init

public final int init(com.ibm.staf.service.STAFServiceInterfaceLevel3.InitInfo info)
Handles initializing this instance of the service for STAF.

This service is registered under process name "STAF/Service/<ServiceName>".

Specified by:
init in interface com.ibm.staf.service.STAFServiceInterfaceLevel3

acceptRequest

public com.ibm.staf.STAFResult acceptRequest(com.ibm.staf.service.STAFServiceInterfaceLevel3.RequestInfo info)
Handles service request from STAF.

Specified by:
acceptRequest in interface com.ibm.staf.service.STAFServiceInterfaceLevel3

term

public final int term()
Handles removing this service from STAF.

Specified by:
term in interface com.ibm.staf.service.STAFServiceInterfaceLevel3

debugPrintln

public static void debugPrintln(java.lang.String msg)
Prints a line to the debug log if debugging is enabled.

Parameters:
msg - the message to print.

debugPrintln

public static void debugPrintln(java.lang.String msg,
                                com.ibm.staf.STAFResult r)
Prints a message and STAFResult to the debug log if debugging is enabled.

Parameters:
msg - the message to print.
t - the STAFResult to print.

debugPrintln

public static void debugPrintln(java.lang.String msg,
                                java.lang.Exception e)
Prints a message and Exception to the debug log if debugging is enabled.

Parameters:
msg - the message to print.
e - the Exception to print.