Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

Logging

TeamConnect's logging functionality allows the system to generate logging messages for information or troubleshooting. As a TeamConnect developer, you can specify messages for log levels during customization, design, and production.

For example, when you are writing and testing code, include Debug messages so that you can see what occurs when your code executes. When code is in production, messages with a higher level of severity, such as Warn or Error, indicate less frequent but more critical problems in your code.

Logs capture messages based on the logger levels that system administrators or solution developers define in TeamConnect. TeamConnect only logs messages for the level defined and the levels of higher severity. As a result, if you include a message in your code for a lower level, TeamConnect does not log the message to the logger. For example, loggers with a Warn level include messages with levels of WarnError, and Fatal. If your code includes a message for the Info logger level, the message does not log.

Loggers for API Code  

TeamConnect has several predefined loggers. Depending on the type of code you are writing, TeamConnect logs messages to the corresponding logger:

  • Code for an automated qualifier or action logs messages to the Rule logger.
  • Code for a custom screen logs messages to the Custom Blocks logger.
  • Code for a custom tool logs messages to the Tools logger.

Logging Messages from the API  

Complete the following steps for your custom code to generate log messages:

  1. On the Logging page of the Admin Settings, define the logging level for the type of logger associated with the code.
  2. Specify logging messages in your code using the CustomItem or Platform logging methods.
  3. Add code that checks the logging levels in TeamConnect before running logging methods.

Specifying Logging Messages

The following classes include methods for logging:

  • CustomItem—Includes the logging methods for code that extends CustomItem, which means automated qualifiers, automated actions, custom screens, and custom tools.
  • Platform—Includes the logging methods for code that does not extend CustomItem.

Both classes include the same logging methods at the following logger levels:

  • Debug
    • logDebug(String message)
    • logDebug(String message, Throwable t)
  • Info
    • logInfo(String message)
    • logInfo(String message, Throwable t)
  • Warn
    • logWarn(String message)
    • logWarn(String message, Throwable t)
  • Error
    • logError(String message)
    • logError(String message, Throwable t)

The following code includes examples of methods that log messages:

String username = "username"; 
Date time = new Date();

// Log some debugging information
logDebug("rule executed by " + username + " at " + time);
// Also possible via Platform
platform.logDebug("rule executed by " + username + " at " + time);

// Log an informational message
logInfo("rule executed by " + username + " at " + time);
// Also possible via Platform
platform.logInfo("rule executed by " + username + " at " + time);

// Log a warning
logWarn("Missing some information");
// Also possible via Platform platform.logWarn("Missing some information");

// Log an error
logError("This is a problem");
// Also possible via Platform platform.logError("This is a problem"); 

Checking Logger Levels

Running code with logging methods can have an impact on performance. You can prevent code from running unnecessarily by first checking whether the specified logger level is enabled on the Logging page of Admin Settings.

The API provides the following methods for checking whether the Debug or Info logger levels are enabled:

  • isDebug() to check for the Debug logger level.
  • isInfo() to check for the Info logger level.

Note: These levels have methods for checking because levels of a higher severity are not intended for code in production.

The following code for logging Debug and Info log messages checks whether the logger levels are turned on before running the log methods.

// Log some debugging information logDebug("rule executed");
// Check the log level before executing complex debugging statements to improve performance
if(isDebug()) {
logDebug("rule executed by " + username + " at " + time); }

// Log an informational message logInfo("rule executed");
// Check the log level before executing complex informational statements to improve performance
if(isInfo()) {
logInfo("rule executed by " + username + " at " + time); 
  • Was this article helpful?