GDL.core: Requests to Granta MI, including retries and elapsed time per request.GDL.http: HTTP status codes and full SOAP request and response content.GDL.cache: Streamlined layer caching information, including cache misses and cache clearing operations.
Logger objects are hierarchical, with levels in the hierarchy being defined by the . character.
Messages are passed from lower level Logger objects to higher level ones. As a result, it is possible to access
all log messages via the GDL logger.
By default, these messages are not output. To output the messages generated by this package and to add your own log
messages, you should:
- Create a logger for your script.
- Attach a handler to the logger.
Creating a logger
TheGDL logger can be accessed in two ways. The first is via the
get_foundation_logger() function:
GDL logger by name using the Python getLogger() function:
GDL.core logger:
getLogger():
Logger objects only handle messages at or above a defined severity level. All new logger objects have a default
log level of WARNING, so they ignore messages of INFO or lower. To change a logger’s log level, use
Logger.setLevel():
NOTE
Until a log handler is attached, no log messages are emitted.Attaching a handler
There are two main types of handlers provided by the Python logging library:FileHandler handlers and
StreamHandler handlers. A FileHandler is used to write log messages to a file on disk, and a
StreamHandler is used to write log messages to stderr or stdout.
To add a StreamHandler handler to the root logger from the previous section, use the following code:
FileHandler. The following example shows the creation of a
FileHandler handler with a filename based on the current date:
%(name)s includes the name of the logger to which the message was logged, which enables a single log file to be
used to capture information from all Scripting Toolkit loggers and loggers created for user code.
Additional logging
The MI Scripting Toolkit underlying C libraries also perform their own additional logging separate to the Python logging. These logs can be found in the following locations:- Windows:
%LOCALAPPDATA%\Granta\Granta MI\ScriptingToolkit - Linux:
~/.appdata/Granta/Granta MI/ScriptingToolkit