Logging Messages

If you want to log Java messages from a COBOL program, use the CJAVA-LOGMESSAGE op-code as follows:

CALL "C$JAVA" USING CJAVA-LOGMESSAGE, "Message to log".

The advantage of using the Java log is that it is thread-safe, and all of the messages from a given thread of execution are written to the same log whether that thread is executing COBOL or Java. Also, logs in Java are highly configurable. Note that the sample log output shown below is formatted to report date, time, class, method, and log level before the message.

11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 COBOL LOG --> Entered TestJavaToCobol 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 COBOL LOG --> Exiting TestJavaToCobol 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 call.error = 0, exit.code = 0, signal.number = 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 exit message = 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Call error: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Exit code: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Signal number: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Exit message: 
11/30/04 2:13:57 PM acuCobolGT.CAcuCobol cblLog INFO -->
			 CobolCallingJavaTest: Complete 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 CobolCallingJavaReentrantTest ()V 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 call.error = 0, exit.code = 0, signal.number = 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_cobol INFO -->
			 exit message = 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Call error: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Exit code: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Signal number: 0 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM cblLog INFO -->
			 Exit message: 
11/30/04 2:13:57 PM com.acucorp.acucobolgt.CVM acu_shutdown INFO
			 --> shutdown called - shutdown param: 0 
11/30/04 2:13:57 PM acuUtilities.AcuJavaTest main INFO -->
			 shutdown complete 
11/30/04 2:13:57 PM acuUtilities.AcuJavaTest main INFO -->
			 calling cobol end