Logging from a groovy script?

      Logging from a groovy script?

      The ETL Server documentation mentions that it's possible to log warnings and errors from a groovy script in a field transform, but I can't seem to make it work. Here's what the docs say:
      Besides the various functionalities Groovy (and Java) offers, specific Palo ETL functionality can be used
      with two classes which are available in the script:

      Methods of class LOG:
      void debug(Object message)
      void error(Object message)
      void info(Object message)
      void warn(Object message)


      And here's the script I'm trying:

      Source Code

      1. DateSanityChecker = InputDate;
      2. if (InputDate.startsWith("1969")) {
      3. LOG.warn("Strange date detected");
      4. };


      Really, all I want is to log a warning if an unusual date is detected (we've been seeing some weird dates in our input from time to time). However, when trying to run this script, I get:

      Source Code

      1. Warning: Failure in function DateSanityChecker:
      2. Unable to execute script:
      3. No such property: LOG for class: Script38


      Any ideas what I'm doing wrong? I've tried "LOG" (which is what the docs say), "Log", and "log" with the same result. Server version 3.0.831.
      Hi scorbett,

      scorbett wrote:

      The ETL Server documentation mentions that it's possible to log warnings and errors from a groovy script in a field transform, but I can't seem to make it work.

      try to script the things you want in a script job and not in a field transform function.
      how to: create a new job, typ: script (instead of standard) and script everything you want! :)

      scorbett wrote:

      DateSanityChecker = InputDate;
      if (InputDate.startsWith("1969")) {
      LOG.warn("Strange date detected");
      };

      i would do that more like this:

      Source Code

      1. metadata = new Properties();
      2. metadata.put("selector", "catalog");
      3. state = API.getConnectionMetadata("${RelConn}",metadata);
      4. if ( state.getData() == "1969" ) {
      5. LOG.warn("Strange date detected");
      6. };

      and remember, you have to adapt the metadata.put() to your project. The intention is to get the data you want to compare with and compare it with the your given variable.

      Regards.
      Djordja Markovic

      Interessant things:
      Internal derby:
      jedox.com/community/palo-forum…ad&postID=14338#post14338
      Calculate your cube size:
      jedox.com/community/palo-forum…ad&postID=14406#post14406