To Create Log Statements

iLogic Logging uses iLogic functions to send log messages to the iLogic Log panel.

iLogic Logging

To generate iLogic logs

  1. Display the new iLogic Log panel: Click the + sign in the browser header or select iLogic Log from the ribbon: View tab Windows panel User Interface drop-down menu.
  2. Add 1 or more logger statements - Logger.log level("message") - to your rule.
  3. Select a log level from the new drop-down menu. 6 levels of logging are supported: Trace, Debug, Info, Warn, Error, and Fatal, plus None. The active log level determines the types of log statements that will be included in the iLogic Log panel. Set the log level to the minimum level you want logged. iLogic will log the statements at that level and those below in the list. For example, when the active log level is Info, then Info, Warn, Error, and Fatal log statements will be included in the iLogic Log panel; When the active log level is Error, then only Error and Fatal will be included; and so on.

    Note: You can specify a log level in the Advanced iLogic Configuration dialog box.
  4. Run the rule. The iLog messages display in the iLogic Log panel.
  5. Right-click in the iLogic Log panel to access the context menu options. Context menu options provide additional options for working with the messages. For example, use the context menu option Clear to clear the current state of the window.
    Tip: Messages created in the iLogic Log panel do not persist across sessions. Use the context menu option, Save, to save the messages generated in the current Inventor session to a permanent file.

Managing Log Messages in the iLogic Log Panel

The active log level controls which logging statements are actually logged. Start by setting the log level to Debug and including logger.debug("message") statements into your rules. Once you've finished debugging and you no longer need the Debug messages, then change the active log level to Info or to another level lower in the list. You don’t need to remove the logger.Debug statements from your rules. Subsequently, only Info, Warn, Error or Fatal messages will appear. This same behavior applies to all log levels. For example, if you change the level to Info, and the log panel is getting cluttered with Info messages, change the log level to Warn. The Info messages will stop appearing, and only the Warn, Error, Fatal messages will display. Setting the active log level allows you to display only the types of messages you need.

Navigation Links

After you clear messages from the panel, navigation links display at the top of the panel if older messages are available. The iLogic Log panel is limited to displaying 20,000 messages at one time. When over 20,000 messages are entered, navigation links at the bottom of the panel allow you access messages created after reaching the 20,000 limit.

Rule Tracing

Rule Tracing

Rule-tracing helps you to visualize when and why a rule is run. Rule Tracing automatically logs messages when a rule is entered and when it is exited, as well as what triggers the rule to run. Simply set the active log level to Trace to see these messages. Set the active log level back to turn them off.

Rule-tracing helps you to visualize when and why a rule is run. Rule Tracing automatically logs messages when a rule is entered and when it is exited, as well as what triggers the rule to run. Add the following line to a rule to enable tracing:

Tip: Use logger.Debug statements, for normal debugging. Only use logger.Trace statements when you need very detailed debugging information. Rule tracing behavior is very detailed and the output can look daunting. Only use Trace level when you need Trace level of detail.

Example of rule tracing output

Select Detailed Trace in the Logic Rule Editor dialog box to automatically generate log messages when running a rule at the Trace level. This setting controls the value of the API property iLogicVb.Automation.LogControl.RuleEntryExitMessageLevel.

Note: This setting is also available in the Advanced iLogic Configuration dialog box.