GPC Logging¶
The GPC includes LOGGER, a global logging object that wraps Python3 logging. You can use logger to record information, such as error messages, directly in your order run logs.
Methods¶
Logger supports several methods, each supporting a different use case.
Print to logs¶
Use LOGGER.info() to print basic messages to order run logs.
Tip
Use the Search logs field to search for specific messages in an order run log.
Logging levels¶
Automation supports the following logging levels:
Depending on the severity level set, the order run log message may appear highlighted in a different color, for improved visibility.
Set level¶
The default level of LOGGER.setLevel() is warning. This method requires import logging in your Python script to change the default level.
Call logger from a secondary file¶
If you're running multiple Python files from the same General Purpose Container, you use logger in a secondary file.
Add the following to any accompanying files:
Python print()¶
Automation also provides support for the Python print() function.
You can use print("Your message here") in any of your GPC .py files in place of LOGGER.info().
Warning
print() may not show accurate message timings in the order run logs. If log message timestamps are important to your DataOps work, use LOGGER.info().