Share this page

# lr.enable_redirection

Enables the redirection of Java output and error streams to the output log.

    void lr.enable_redirection ( booleanflag);

Message Functions

## Arguments

Name | Comments
--- | ---
flag | true or false (quotation marks not required).

The lr.enable_redirection function causes Java output and error streams to be redirected into log files and output windows when the flag is set to "true". If the script, or one of the classes invoked by it, uses output or error streams to print messages, they are redirected to the log files. By default, redirection is enabled. To disable, set the flag to "false".

If an application uses its own redirection, the lr.enable_redirection function overrides it. To restore the application's redirection, call this function using the "false" flag.

## Return Values

This function has a void return value.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Examples

### Example 1

In the following example the lr.enable_redirection function causes Java output and error streams to be redirected into log files and the Output window.

Copy code

      lr.enable_redirection(true);
        :
        :
      System.out.println("<span style="font-weight: bold;">Application running!</span>");
        :
        :
      if ( rc != 0 )
         System.err.println("<span style="font-weight: bold;">Application failed!</span>");
        :
        :
      lr.enable_redirection(false);

### Example 2

In the following example, lr.enable_redirection directs Java output to an output stream.

Copy code

    int var=100;
    lr.enable_redirection(true);
    outstr.println("The value of the variable is "+var);
    return 0;

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: