Follow

Turn on Runtime Logging?

When you run your Elastic COBOL applications significant events can be logged to a file or the console.  Depending on the logging level you might see low-level program lookups and I/O operations to disk or high-level CICS API calls.

Logging (or program tracing) is integrated with the Java Logger API.  Various loggers can be incorporated into your programs at runtime and certain JEE servers may already have default loggers (e.g., Log4J) configured.  But, a default Logger is always available as it is built into the Java Virtual Machine.

To enable logging when running Elastic COBOL applications set the Java VM property LOG=true.  This is a global setting particular to Elastic COBOL that causes the runtime to invoke the Java Logger API.  Next you must configure the logger and this is done through a Java "properties" file, a set of name/value pairs that set up logging criteria.  Copy and change the JVM's default logging properties file ("lib/logging.properties" in the JVM or JRE's home directory and make modifications to turn on various levels, files, etc.  The most significant settings in this properties file are:

handlers= java.util.logging.ConsoleHandler
.level= ALL
java.util.logging.ConsoleHandler.level = ALL

The handlers specify whether logging goes to the console (standard error, SYSERR) or a specified file.  Both the default .level and the ConsoleHandler.level must also be set.   The levels are:

  • SEVERE
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST

and ALL indicates that all logging should be produced.

To run the program with logging from Eclipse use the Run > Debug Configurations menu to create a debug configuration and then set the VM Arguments to:

-DLOG=true -Djava.util.logging.config.file=/home/you/logging.properties

When running from the command line put these parameters on the Java command line:

java -DLOG=true -Djava.util.logging.config.file=/home/mnh/bin/logging.properties -cp .:ecobol.jar myprog

And if running a job under EBP / JES, set the EBP Configuration parameter javacommand to a value in the jes.properties for or set it with the config Web service or from the EBP / JES home page:

http://localhost/ebp/config?javacommand=java+-DLOG=true+-Djava.util.logging.config.file=/home/mnh/bin/logging.properties

The output will be sent to the console or, if configured in the logging.properties file, a file location.  An example logging message when a COBOL program calls another COBOL program ("ETP_LINK") with FINER logging level turned on:

Oct 23, 2013 5:16:29 PM com.heirloomcomputing.ecs.exec.Context call
FINER: call(s,s,i,s[][],parameterList,Ojbect): 0 programName=ETP_LINK. normalName=etp_link. callingConvention=-1. localNameConverter=null. params=com.heirloomcomputing.ecs.exec.parameterList@522305c2. returnCode=00000.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk