Important tools during the implementation of a system activity are debugging and error handling. By extending the default methods in PHP (e.g. echo, print_r etc.) the API offers a possibility to write debug information into a log file created for this purpose. It is saved in the JobRouter basic directory under output/log/<systemActivityId>_<date>.log.
Depending on the JobRouter constant CONST_LOGLEVEL_FILE, which has to be part of the config.php, the API methods debug and error write the appropriate messages into the file. Now we would like to check if the returned parameter matches the settings in the interface. For this we open the config.php file and set the value of the relevant constant:
Contents of config.php
<?php
...
define('CONST_LOG_LEVEL_FILE', 'DEBUG');
Then we add a row of program code to the basic class.
Implemented debug output
<?php
class csvSystemActivity extends AbstractSystemActivityAPI
{
...
protected function exportCsv()
{
$fieldDelimiter = $this->resolveInputParameter('fieldDelimiter');
$this->debug('Separator: '.$fieldDelimiter);
}
}
When the system activity is now executed, a new entry in the log file will be created, which consists of the current date, the log status, the JobRouter version and the output of the separator.