Example: lr.debug_message
In the following example, the lr.debug_message function assigns a message to a full trace log. Since this log level was set by lr.set_debug_message, the message appears in the log.
The second call to set_debug_message resets the message level to its former value.
//Add the following to the beginning of the file:
import java.lang.* ; import java.io.* ; // Set the extended and full trace log options. lr.set_debug_message(lr.MSG_CLASS_EXTENDED_LOG |lr.MSG_CLASS_FULL_TRACE, lr.SWITCH_ON); PrintStream outstr; try { File file = new File("c:/temp/Java" + Thread.currentThread() + ".txt"); FileOutputStream fos = new FileOutputStream(file.getName()); outstr = new PrintStream(fos); } catch (IOException e) { outstr = null; // lr.debug_message Sends a debug message to the Output window. // Send a message only when the message level is set to Full Trace lr.debug_message (lr.MSG_CLASS_FULL_TRACE, "Exception occurred" ); outstr.println("Init (vuser " + lr.get_vuser_id() + ")"); lr.set_debug_message(lr.MSG_CLASS_EXTENDED_LOG |lr.MSG_CLASS_FULL_TRACE, lr.SWITCH_OFF); }