Redirecting JVM stdout and stderr output

During application development, the USEROUTPUTCLASS option can be used by developers to separate out their own JVM stdout and stderr output in a CICS region, and direct it to an identifiable destination of their choice. You can use a Java™ class to redirect the output, and you can add time stamps and headers to the output records. Dump output cannot be intercepted by this method.

Specifying the USEROUTPUTCLASS option has a negative effect on the performance of JVMs. For best performance in a production environment, do not use this option.

Output written to System.out() or System.err(), either by an application or by system code, can be redirected by the output redirection class. The z/OS® UNIX files named by the STDOUT and STDERR options in the JVM profile are still used for some messages issued by the JVM, or if the class named by the USEROUTPUTCLASS option is unable to write data to its intended destination. You must therefore still specify appropriate file names for these files.

To use the USEROUTPUTCLASS option, specify USEROUTPUTCLASS=[java class] in a JVM profile, naming the Java class of your choice. The class extends java.io.OutputStream. The supplied sample JVM profiles contain the commented-out option USEROUTPUTCLASS=com.ibm.cics.samples.SJMergedStream, which names the supplied sample class. Uncomment this option to use the com.ibm.cics.samples.SJMergedStream class to handle output from JVMs with that profile. CICS® also supplies an alternative sample Java class, com.ibm.cics.samples.SJTaskStream.

The source for the supplied user output classes is provided as samples, so you can modify the classes as you want, or write your own classes based on the samples.

For JVM servers, you package your output redirection class as an OSGi bundle to run the class in the OSGi framework. For more information, see Writing Java classes to redirect JVM stdout and stderr output.

Note: Start of changeOutput redirection samples function in OSGi and classpath JVM servers and not in Liberty.End of change