AnsweredAssumed Answered

Groover Error using Logger class

Question asked by PatrickBrilino6911 on Oct 17, 2013
Latest reply on Oct 30, 2013 by mike_aronson
I'm trying to log data to the process log to debug my Groovy script, but coming on this error:

Test execution of NS Fulfillment to SFDC Asset (Master Process) completed with errors. Embedded message: Error executing data process; Caused by: startup failed, Script2.groovy: 9: unable to resolve class Logger @ line 9, column 8.Script2.groovy: 38: unable to resolve class Logger @ line 38, column 3. 2 errors (in groovy script); Caused by: startup failed, Script2.groovy: 9: unable to resolve class Logger @ line 9, column 8.Script2.groovy: 38: unable to resolve class Logger @ line 38, column 3. 2 errors

I followed the instructions in this article, so I'm not sure why it's not working.  Here is my groovy script I'm using in a Data Process step:

      
     import org.jdom.input.SAXBuilder;
     import org.jdom.Document;
     import org.jdom.Element;
     import org.jdom.xpath.XPath;
     import org.jdom.output.XMLOutputter;
import com.boomi.execution.ExecutionUtil;
      
Logger logger = ExecutionUtil.getBaseLogger();
      
     // Set the delimiter character separating the values.
     String delimiter = " ";
      
      
     // Loop through the Process Documents
     for ( int i = 0; i < dataContext.getDataCount(); i++ ) {
      
          InputStream is = dataContext.getStream(i);
          Properties props = dataContext.getProperties(i);
      
          // Build XML Document
          SAXBuilder builder = new SAXBuilder();
          Document doc = builder.build(is);
      
     //Need XPath Query with namespace
          XPath x = XPath.newInstance("//ns1:itemList/ns1:item");
     x.addNamespace("ns1", "urn:sales_2013_1.transactions.webservices.netsuite.com");
      
          // Select multiple nodes and loop through them
          myElements = x.selectNodes(doc);
      
          for (Element myElement : myElements) {
      
             // Get the element name & value
             String elementName = myElement.getName();
             String elementValue = myElement.getText();
      
logger.info("Processing serial number: " + elementValue);
      
             // Get parent element and remove current element
             Element parentElement = myElement.getParent();
             myElement.detach();
      
             // Loop through parts and add new Elements to parent
             String[] parts = elementValue.split(delimiter);
             for (int j=0; j<parts.length; j++) {
      
                newElement = new Element(elementName).addContent(parts[j]);
                parentElement.addContent(newElement);
      
             }
      
          }
      
      
          XMLOutputter outputter = new XMLOutputter();
          is = new ByteArrayInputStream(outputter.outputString(doc).getBytes("UTF-8"));
      
          dataContext.storeStream(is, props);
      
     }
      

Outcomes