The logging framework is provided in the package com.engineous.sdk.log.
The logging facility is accessed through the runEnv object passed in
to the “execute” method by invoking
Log log = runEnv.getJobLog();
Because logging can carry a fair amount of overhead for processing the
messages back to clients through a SIMULIA Execution Engine
the logging facility considers a severity level for each message when
deciding whether or not to process the message. A client can specify
the severity level of interest for a given Job, and only messages of
that severity or higher will be processed.
The following severity levels, in increasing order from low to high,
are recognized by the logging facility:
- Debug
Use this severity to provide a mechanism to track the progress
of the execution within the component at a detailed level, typically
to uncover the precise location at which something is going wrong.
log.logDebug(new IString(CLASS, 0, "Finished reading properties"));
- Info
Use this severity to provide messages back to the client to inform about
significant incidents/status or to redirect end application messages during
execution.
Do not overuse this severity for debugging or numerous routine messages
because performance could be affected.
log.logInfo(new IString(CLASS, 0, "Excel application was closed.
Re-starting Excel..."));
- Warning
Use this severity to inform the client that some noncritical issue was
encountered, possibly causing the execution to behave in an unexpected manner.
log.logWarn(new IString(CLASS, 0, "Aborting optimization execution
- no design variables specified"));
- Error
Use this severity to inform the client that the component execution has
failed because of the way the component execution was configured or because of
some underlying application error that is expected in various situations.
log.logError(new IString(CLASS, 0, "Aborting optimization execution
- no design variables specified"));
- System Error
Use this severity when the component code has encountered an
unexpected error in the program, typically indicating a bug or defect that should be
reported so that it can be fixed.
log.logSysError(new IString(CLASS, 0, "Failure starting
application"));
Note:
All examples assume the log object was retrieved as noted above; IString: A message internationalization object that
must be used for the messages. It is provided in the package com.engineous.common.i18n.
Depending on the intent of the message you are trying to log, set the
severity appropriately so that an end user can set the desired logging
level and receive only the appropriate corresponding messages.