Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is handy to use logging because Logic Test Drive does not behave exactly the same way as when the logic runs in a "real" environment. Then the LOG file helps you find out what is going on.

Table of Contents
maxLevel1

Logging from Groovy

Code Block
languagegroovy
api.logInfo("Target Date", api.targetDate())
api.logWarn("A bigger problem", "something important")

...

Code Block
languagegroovy
api.trace("competitorName", null, competitorName)
api.trace("competitorName", "", competitorName)
api.trace("Current month - Last month", currentMonth, lastMonth)

When you run the calculation logic using the Test Logic (Debugger), then you get: Image Removed

...

Printing Information about Data Object

Groovy defines additional functions on objects:

  • dump()

  • inspect()

Both can be used to format nicely (and then display) what is in the object.

...

To see the log file for your partition:

  1. Go to Admin > View Logs.

  2. A new window with a "live" log opens, with the latest log record at the top. It reloads automatically every couple of seconds.

Setting up Logging

If a record does not show up in the log file, verify the following:

...

  1. Allow Groovy logging in General Settings in Configuration.

...

  1. (warning) Settings on this page do not apply immediately. Because of caching it can take up to 5 minutes.

  2. Ensure that your partition has the logging level set for SandboxAPI.

    1. Log in as the root.

    2. Go to System Admin > View Logs > Log Levels.

    3. Filter for "Sandbox" and check the level setting.

...

    1. Image Added
  1. If the logging still does not work, restart the pricefx-server.