When using scripting within a Map Function or Data Process step, it can be very helpful to view to values of variables at run time to assist with development and debugging. You can do this by writing entries to the Process Log using Groovy script.
- This will write entries to the Process-level Log. You cannot write to the Document-level Log.
- Alert notifications will NOT be sent for entries, regardless of Log Level (e.g. Warning or Errors).
Use the following syntax in your Groovy scripts:
At the top of scripting, include an import statement for the ExecutionUtil and Logger class and get a handle to the Logger class. For those familiar with Java, this is the standard Java Logger class.
import com.boomi.execution.ExecutionUtil; import java.util.logging.Logger; Logger logger = ExecutionUtil.getBaseLogger();
Then throughout your script, use the following line to write an entry to the Process Log.
logger.info("Hello Process Log!");
One of the main purposes of writing to the Process Log is to inspect the value of a variable at run time, so you can reference that variable in the log entry. Simply include the variable in the message string like this.
logger.info("Processing customer: " + customerNumber);
Additional methods that can be used are:
to create entries with different Log Levels.
Tip: Create your messages at the WARNING level to be able to quickly filter the Process Log to find your entries. Remember, even though it is a WARNING level, it will not generate an alert notification or affect the document or execution status.
Additional information can be found at the following Oracle JAVA API link: Logger (Java Platform SE 6)