Support for iLogic Logging and Rule Tracing
Inventor 2019.1 update is now live for subscription customers! You should be able to download it from your Autodesk Desktop app. The information in this article is from the official Autodesk Inventor 2019.1 help file.
iLogic now provides a type of PRINT statement that can be used in rules. This new functionality, called iLogic Logging, uses new iLogic functions to send log messages to a new Inventor panel and also to a log file. In addition, there’s a new automatic rule tracing mechanism. Rule tracing helps you to visualize when and why a rule is run.
To generate iLogic logs:
- 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.
- Add 1 or more logger statements – Logger.LogLevel(“message“) – to your rule. For example: Logger.Debug(“Here we are in phase 2”)
- 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 also specify a log level in the Advanced iLogic Configuration dialog box.
For example, add Logger.Info(“Hello World”) to your rule to generate the following when you run the rule:
- 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.
Rule-tracing is a new iLogic feature that 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.