Log
Logging is essential for debugging and monitoring the SDK's behavior and interactions with the peripheral. It is Nayax's main tool for understanding what's happening on the peripheral's end, as well as in the connection between the device and peripheral.
Configuration
To have logs of the SDK, you need to configure the following flags in the main
method:
dump_packets_level
(vmc_configuration
): Determines the level of detail required to log messages generated by the SDK. These are the options available:debug_level_dump_none
: Don't generate a log.debug_level_dump_all
: Log all messages.debug_level_dump_moderate
: Logs all messages, excluding keep-alives and their ACKs.
debug
( boolean): Enables or disables log generation.
You can add these flags to the main method, as in the example below.
public static void main(string[] args) {
vmc_config.dump_packets_level = vmc_configuration.debug_level_dump_moderate;
vmc_config.debug = true;
}
public class vend_machine
vmc_config.debug = true;
vmc_config.dump_packets_level = vmc_configuration.debug_level_dump_moderate;
vmc_init()
config.dump_packets_level = debug_level_dump_none;
Log file location
The logs generated by the SDK are written to a specific file location.
-
On the C# SDK, the logs are automatically saved inside the same directory you run the SDK from, inside the
bin\Debug
folder. For example: -
On the C SDK, the log location is determined by invoking the function below.
void printk_register_puts(printk_puts_pfunc cb);
-
On the Java SDK, the default log file path is specified in the
FileWriter
initialization. See the following example.if (vmc_config.debug) { BufferedWriter out = null; try { FileWriter fstream = new FileWriter("c:\\out.txt", true); // true to append data out = new BufferedWriter(fstream); Log.initialize(out); } catch (Exception ex) { // Handle exception } }
In the code above, the log file is created at the root of the C: drive with the name out.txt
. The true
parameter in the FileWriter
constructor indicates that data will be appended to the existing log file if it already exists.
Updated 18 days ago