Activating and managing tracing for Node.js applications

You can activate Node.js application tracing by turning on SJ component tracing. Small amounts of trace are written to the internal trace table, but Node.js also writes out logging information to a unique file in zFS for each Node.js application. This file does not wrap so you must manage its size in zFS.

About this task

Node.js application tracing does not use auxiliary or GTF tracing. CICS® writes some information to the internal trace table. However, most diagnostic information is logged by Node.js and written to a file in zFS. This file is uniquely named for each Node.js application. The default file name has the format &DATE;.&TIME;.trace and is created by CICS in the $WORK_DIR/&APPLID;/&NODEJSAPP; directory when you enable the NODEJSAPP resource. You can change the name and the location of this trace file by using the TRACE profile option. Changes to the profile take affect when the NODEJSAPP resource is enabled. If you delete or rename the trace file when the Node.js application is running, CICS does not re-create the file and the logging information is not written to another file.

Procedure

  1. Use the CETR transaction to activate tracing for the Node.js application. Select the SJ component to trace the actions taken by CICS to start and stop the Node.js application. Node.js logs diagnostic information in the zFS file.
  2. Set the tracing level for the SJ component:
    • SJ level 0 produces tracing for exceptions only, such as errors during the initialization of the Node.js application. SJ level 1 and level 2 produce more CICS tracing from the SJ domain. This tracing is written to the internal trace table.
    • SJ level 3 produces additional logging from Node.js, such as warning and information messages. This information is written to the trace file in zFS.
    • SJ level 4, 5 produce debug information from CICS and Node.js, which provides much more detailed information about the Node.js application processing. This information is written to the trace file in zFS.
  3. Each trace entry has a date and time stamp. You can change the name and the location of this trace file by using the TRACE profile option.
  4. If you are using the default TRACE settings, when you enable the NODEJSAPP resource CICS creates a new unique trace file for the life of the Node.js application.
    If you disable the NODEJSAPP resource, you can delete the trace file or rename the file if you want to retain the information separately.
  5. To manage the number of files, you can set the LOG_FILES_MAX option to control the number of old trace files that are retained on the Node.js application startup.