Logging and Debugging
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.
Logging from Groovy
api.logInfo("Target Date", api.targetDate())
api.logWarn("A bigger problem", "something important")
Tracing (only under Logic Test)
api.trace("name", value1, value2)
Example
Given that you have a calculation logic with a Groovy element containing the following code:
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:Â
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.
Accessing Log File
To see the log file for your partition:
Go to Admin > View Logs.
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:
Allow Groovy logging in General Settings in Configuration.
 Settings on this page do not apply immediately. Because of caching it can take up to 5 minutes.Ensure that your partition has the logging level set for SandboxAPI.
Log in as the root.
Go to System Admin > View Logs > Log Levels.
Filter for "Sandbox" and check the level setting.
If the logging still does not work, restart the pricefx-server.
Found an issue in documentation? Write to us.
Â