Logger |
To use Composite Application Logging, a Web application must have the infrastructure to log messages. To achieve Web logging capabilities, the logging framework in the Java layer has been extended by a generic logging service. The generic logging service is provided by the logger library.
The request sent by the logger library is as follows:
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <LogMessage xmlns="http://schemas.cordys.com/log/1.0/"> <DC name="user">The user DN</DC> <DC name="url">The URL of the application</DC> <DC name="applicationID">The application ID used by BDI</DC> <DC name="fileName">The htm or js file name where the log message is originating</DC> <DC name="BPM Name">MyProcess</DC> <Level>INFO</Level> <Message>Custom messsage</Message> </LogMessage> </SOAP:Body> </SOAP:Envelope>
The various methods defined for this component are as follows:
Table 1. List of Methods
Method |
Description |
---|---|
getLoggerContext() |
Retrieves the logger context set for the Web application |
log(sLogLevel, sLogMessage) |
Sends the log request to the back end The possible values are:
|
setDiagnosticContext(sContextName, sContextValue) |
Sets the diagnostic context for a Web application The possible values are:
|
setLoggerContext(ologgerContextXML) |
Sets the logger context for a Web application. This method overwrites the system generated logger context of the application. The logger context can be set using the following format: <Logger> <DC name="ApplicationName">My Composite Application</DC> <DC name="correlationID">8d3a0e69-0ac0-4541-015b-0afddd34f6f7</DC> <DC name="hopCount">0</DC> </Logger> |
getEncodedLoggerContext(oInputXMLNode) |
Sends a request to the CompressAndEncode Web service to compress and encode an XML node. Returns a JavaScript object that holds the <Logger> <DC name="ApplicationName">My Composite Application</DC> <DC name="correlationID">8d3a0e69-0ac0-4541-015b-0afddd34f6f7</DC> <DC name="hopCount">0</DC> <Level>ERROR</Level> </Logger> |
enrichRequestWithLoggerContext(request) | Appends the logger related details to the request. This must be done before sending the request. |
isDebugEnabled | Returns true if the Logger is enabled for debugging (DEBUG) |
isInfoEnabled | Returns true if the Logger is enable for information (INFO) |
isWarningEnabled | Returns true if the Logger is enable for a warning (WARN) |
isErrorEnabled | Returns true if the Logger is enable for an error (ERROR) |
isFatalEnabled | Returns true if the Logger is enable for a fatal error (FATAL) |
Example
The following sample code demonstrates the use of methods to set a custom diagnostic context for a Web application.
var loggerObject = application.getLogger(); loggerObject.setDiagnosticContext("myContext", "myBusinessProcess");