AMT Help Files

AMT JCL

 This information is incomplete.

The AMT JCL Python library uses Python's built-in logging module. The logging module is part of the Python standard library and provides a way to configure different loggers, handlers, and formatters. This means that every module in the JCL library can have its own logger, based on the module's name. This way it is easy to identify where log messages are coming from.

The Python logging module is configured using a configuration file, which describes the default behavior of the logging system. The location of the JSON configuration file can be set using the JCL_LOG_CONFIG_FILE environment variable.

Setting the Environment Variable

The file path pointing to the location of the JCL logging file can be set using the JCL_LOG_CONFIG_FILE environment variable. Follow the instructions below.

Windows

  1. Open the Settings of Windows and navigate to System.
  2. Click on Advanced system settings A new dialog appears.
  3. Click on the Environment Variables button.
  4. Under System variables, click on the New button.
  5. Fill out the Variable name and Variable value as follows:
    1. Set the Variable name to JCL_LOG_CONFIG_FILE.
    2. Set the Variable value to point to the location of the JCL logging file.
  6. Click the OK button.

Linux

  1. Open a terminal.
  2. Open the environment file in a text editor: sudo <text editor> /etc/environment.
    • Text editor: specify a text editor, such as nano, vim, gedit, and kate.
  3. Enter the super user password to authenticate.
  4. Add the following line at the end of the file: JCL_LOG_CONFIG_FILE="<value>".
    • The value should point to the location of the JCL logging file.
  5. Save the file.
  6. Open a new terminal and run echo $JCL_LOG_CONFIG_FILE to verify the variable has been set successfully.

Enabling Support For OpenTelemetry

Usage of OpenTelemetry is optional and it is disabled by default. To enable OpenTelemetry, the following settings need to be configured in the jcl-config.json file.

Example:

"otel_collector_host": "localhost",
"otel_collector_port": "4317"

Available Logging Settings

The following settings are available in the jcl-logging.conf file:

Setting Available Values Description
level DEBUG
INFO
WARNING (default)
ERROR
CRITICAL
Sets the level of logging.
  • 'DEBUG' exposes detailed information to diagnose bugs.
  • 'INFO' exposes general information.
  • 'WARNING' exposes potential issues.
  • 'ERROR' exposes serious issues.
  • 'CRITICAL' exposes severe issues that may prevent the job from running.
class <class> Indicates the handler’s class
formatter <formatter> Indicates the key name of the formatter for this handler. Formats can be customized in the [formatter_<format_name>] section, for example:
[formatter_jcl_log_formatter]       
format=[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s
                
args () (default)
(sys.stdout,)
The list of arguments to the constructor for the handler class. This is evaluated in the context of the logging package's namespace. If a log directory location was specified but does not exist, the directory is automatically created.

Sample File

jcl_logging.conf

[loggers]
keys=root

[handlers]
keys=console,file

[formatters]
keys=jcl_log_formatter

[logger_root]
level=DEBUG
handlers=console,file

[handler_console]
level=WARNING
class=StreamHandler
formatter=jcl_log_formatter
args=(sys.stdout,)

[handler_file]
class=amt_jcl.amt.jcl.log.handlers.JclRotatingFileHandler
formatter=jcl_log_formatter
args=('./logs/job_summary.log', 'a', 1048576, 10)

[formatter_jcl_log_formatter]
format=[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s