Example: Enabling logging and tracing for application clients
The ActiveX to EJB bridge provides two logging and tracing formats: Windows Application Event Log and Java Trace Log.
- Windows Event Log
The Windows Application Event Log shows JNI errors, Java console error messages, and XJB initialization messages. This log is most useful for determining XJBInit() errors and any unusual exceptions that do not come from the Java environment. By default, critical error logging will be enabled and debug and event logging is disabled.
To enable or disable logging of certain event types to the Windows Event Log, specify one or more parameters to XJBInit(). If more than one parameter is set, they will be processed in the order in which they appear in the input string array to the XJBInit() method. Once the XJBInit() method is initialized, these parameters can no longer be set/reset for the life of the process. Using Java java.lang.System.setProperty() to set these values also has no effect.
- -Dcom.ibm.ws.client.xjb.native.logging.debug=enabled|disabled
Enables or disables debug level messages from displaying in the Windows operating system event log. This level of logging is most useful and shows most internal errors, user programming issues or configuration problems.
- -Dcom.ibm.ws.client.xjb.native.logging.event=enabled|disabled
Enables or disables event level messages from appearing in the Windows operating system event log.
- -Dcom.ibm.ws.client.xjb.native.logging.*=enabled|disabled
Enables or disables both event and debug level messages from appearing in the Windows operating system event log. It is not possible to disable some critical error messages from being displayed in the error log. Only debug and event level messages can be disabled.
Viewing the Windows application event log with the event viewer:
To open the event viewer in the Windows operating system:
- Click Start > Sets > Control Panel.
- Double-click Administrative Tools.
- Double-click Event Viewer.
All ActiveX to EJB bridge events display the text WebSphere XJB in the source column and in the application log. For information about using Event Viewer, click the Action menu in Event Viewer> Help.
To open the even viewer in the Windows operating system, click Start > Programs > Administrative Tools > Event Viewer. All ActiveX to EJB bridge events have the text WebSphere XJB in the source column and display in the application log. For information about using Event Viewer, click the Help menu in Event Viewer.
- Java trace log
The Java trace log displays information we can use to debug method calls, class lookups, and argument coercion problems. Since the Java portion of the bridge mirrors the function of the COM IDispatch interface, the information in the trace log is similar to what we have come to expect from an IDispatch interface. To understand the trace log, we need a fundamental understanding of IDispatch.
To enable user-logging, add the following parameters to the XJBInit() input string array:
"-DtraceString=com.ibm.ws.client.xjb.*=event=enabled" "-DtraceFile=C:\MyTrace.txt"
Developing ActiveX client application code