Mechanical has a logging system that is useful when debugging issues. Normally, it is enabled by setting environment variables before starting Mechanical. With PyMechanical, it is possible to configure logging at any time, whether it is before or after creating the embedded application, using the same Python API.
Configuration class to
configure logging to the standard output for all warning messages and above (which are error and fatal messages).
import ansys.mechanical.core as mech
from ansys.mechanical.core.embedding.logger import Configuration, Logger
_ = mech.App()
After the embedded application has been created, you can write messages to the same
log using the
Logger class like this:
from ansys.mechanical.core.embedding.logger import Logger