How to log custom messages in machine configs


#1

When you need to add custom log messages on different steps of machine config execution, one can utilize log plugin and log built in object, more details here:

https://kb.workfusion.com/display/WF/log

As a bonus “warn” or higher messages will appear on the Info dialog popup (where execution events/errors use to be displayed)

   <log message="attribute message, default level (INFO)"/>
   <log message="attribute message, level=error" level="ERROR"/>
      
   <log level="WARN">
     <template>message template, execution of the record with id: ${record_id}</template>
   </log>
  
   <script>
          <![CDATA[
          log.info("logs info message");
          log.warn("logs warn message");
          log.warn("executing record with id: {}", record_id.toString());
            
          try {
              Integer i = null;
              i.intValue();
          } catch (Exception e) {
            log.error("Error!!!", e);
            log.error("Error short: {}", e.getMessage());
            log.debug("Error debug!!!");        
          }
       ]]>
    </script>