Working with HCL OneTest API Agent logs

To configure the HCL OneTest™ API Agent logs, including those for the RunTests command when run from the command line, update the HCL OneTest API Agent logging properties file.
Following are a few scenarios in which you need to configure logging for the HCL OneTest API Agent:
  • You run tests and stubs on agents.
  • You run RunTests command (from the command line) from the HCL OneTest API Agent installation directory.
  • You experience problems and want to view the error messages.
  • You see that excessive disk space is used by the HCL OneTest API log files.
  • You want to configure the level of logging and the location of the logging files.
To configure logging for HCL OneTest API Agent, do the following steps:
  1. In the home installation directory of HCL OneTest API Agent, locate agent-logging.properties.
  2. Open agent-logging.properties in a text editor.
  3. Configure the logging handlers:
    You can have HCL OneTest API Agent write the logs to a console, to a file, or to both. Locate the property that configures the type of logging to use and update it as needed. For example:
    agent.handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
    By default, both console logging and file logging are enabled for HCL OneTest API Agent.

    Agent engine processes do not have a display associated with them, and hence console logs from an engine are written into the agent log and the logging level is set to WARNING by default. Therefore, if you use console logging for the agent engines and set a different log level, it will not have any effect. File logging from engine processes are controlled by the engine.java.util.logging.FileHandler.level and engine.product_packages.level properties found in the agent-logging.properties file.

    Note: You can run HCL OneTest API Agent from the command line or as a service. If you are running the agent as a service, you must use file logging to capture the log messages.
    The log files for agent and engine processes are written to the logs directory that is located at the home installation directory of HCL OneTest API Agent. On Windows computers, all users have "modify" permissions to the logs directory by default. You can modify the directory permissions to restrict the access as required after the installation.
    Note: The naming convention of the log files has changed over the releases. Starting from version 9.2.0, they are named as agent*.log and engine*.log.
  4. Set the log level:
    Use the following properties in agent-logging.properties define the log level for the agent and engines:
    • agent.java.util.logging.ConsoleHandler.level: The level at which the agent process logs to the console window, if started from the command line.
    • agent.java.util.logging.FileHandler.level: The level at which the agent process logs to a log file.
    • engine.java.util.logging.FileHandler.level: The level at which the engine process started by the agent is logged to a log file.
    • agent.product.packages.level: The level at which classes related to the agent are logged.
    • engine.product.packages.level: The level at which classes related to an engine are logged.
    Set the properties to any of the following built-in log levels: SEVERE (to show the least amount of details on worst error conditions only), WARNING, INFO, CONFIG, FINE, FINER, FINEST (to display every message with more detail, most of which are not errors).
    Warning: Log levels associated with lower severity such as FINER and FINEST output large amounts of data to the logs, which might make your debugging process difficult. Therefore, do not use them unless necessary.
In this example, the Agent process is configured to provide both console and file logging. The Agent process console messages will include SEVERE, WARNING, and INFO level messages, while the Agent process file logging messages will include the FINEST level of details. The Agent product packages are configured to export messages to the logging components with the FINEST level of details.

The Agent engine process(es), started by the Agent process, are configured to provide file logging. The file logging for Agent Engine process(es) will include the FINEST level of details. The Agent engine product packages will export messages to the logging components with the FINEST level of details.

#------------------------------- TYPE OF LOGGING ------------------------------
agent.handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
engine.handlers = java.util.logging.FileHandler
#---------------------------- DEFAULT LOGGING LEVEL --------------------------- 
.level = INFO
#------------------------------- FILE LOGGING ---------------------------------
agent.java.util.logging.FileHandler.level = FINEST
engine.java.util.logging.FileHandler.level = FINEST

agent.java.util.logging.FileHandler.limit = 5000000
engine.java.util.logging.FileHandler.limit = 5000000

agent.java.util.logging.FileHandler.count = 2
agent.java.util.logging.FileHandler.pattern = %b/logs/agent-%u-%g.log

engine.java.util.logging.FileHandler.count = 2
engine.java.util.logging.FileHandler.pattern = %b/logs/engine-%u-%g.log
#---------------------------- AGENT CONSOLE LOGGING ---------------------------
agent.java.util.logging.ConsoleHandler.level = INFO
#------------------------------ PACKAGE LOG LEVELS ----------------------------
agent.product_packages.level = FINEST
engine.product_packages.level = FINEST

Configuring the RunTests logs

The HCL OneTest API Agent installation directory also contains a copy of the it-logging.properties file. This file is used to control logging when you use RunTests from the Agent installation directory. Ensure that the logging configuration file specified in RunTests.ini has the same changes applied to it while setting the log level for HCL OneTest API Agent.

  1. In the HCL OneTest API Agent installation directory, locate RunTests.ini.
  2. Find the property labeled -Djava.util.logging.config.file and verify its value. By default, this property points to the same file as it does in IntegrationTester.ini. Therefore, no additional changes are required.

Identifying engines from logs

All engine processes started by an agent share a common log file name pattern as defined by the engine.java.util.logging.FileHandler.pattern property. Within the engine log file, INFO level messages are output with identity information:
INFO: instanceName: instance1
INFO: agentId: fb2348d5-6dec-40db-9046-44827513a44a

The instance name and agent ID can be matched to the name and ID that are shown in HCL Quality Server under the details for the Virtualization agent. To check to which stub and project this instance number applies, go to the Agents page and click search for the Virtualization agent:

agent_deployed

Optional: Increasing the logging from an engine

When you deploy a stub to an agent, the running of the stub occurs in an engine process that is started by the agent. Therefore, to help diagnose problems when the stub runs, you might want to increase the level of logging for the engine processes. To change the logging level for the engine to FINEST:
  1. Stop any stubs. When all stubs are stopped, engine processes automatically terminate after a period of inactivity (default 2 minutes). For more information about stopping stubs, see Stopping stubs.
  2. In agent-logging.properties, update the engine.product_packages.level property as needed. For example: engine.product_packages.level = FINEST
  3. Save the changes.
  4. Restart the stubs. For more information about restarting stubs, see Starting stubs.

Optional: Setting the log file location and patterns

Locate the properties that define the log file patterns for the agent process and any engine processes and update them as needed.

To change the default location, do the following steps:
  1. Stop any stubs. When all stubs are stopped, engine processes automatically terminate after a period of inactivity (default 2 minutes). For more information about stopping stubs, see Stopping stubs.
  2. Stop the agent.
  3. Open agent-logging.properties.
  4. Update the following properties as needed:
    agent.java.util.logging.FileHandler.pattern = %b/logs/agent-%u-%g.log
    engine.java.util.logging.FileHandler.pattern = %b/logs/engine-%u-%g.log
    For information about what each substitution variable (for example, %b) represents, see the comments in agent-logging.properties.
    Note: You can use forward slash (/) as the file separator character in the pattern, even on Windows systems.
  5. Save the changes.
  6. Restart the agent. If you are running the agent from a command window, you can see a message that indicates to which directory the log file is being written. For details about restarting agents, see Running agents.
  7. Restart the stubs. For details about restarting stubs, see Starting stubs.

Optional: Changing the name and location of the logging properties file

Change the name and location of the logging properties files as follows:
  1. In the home installation directory of HCL OneTest API Agent, locate the Agent.ini file.
  2. Open Agent.ini in a text editor.
  3. Locate the property that defines the logging properties file (-Djava.util.logging.config.file) and update the value as required. For example:
    -Djava.util.logging.config.file=./C:/myfolder/logs/itAgentLog.properties
Feedback