I tried print_r($var, true), it works. But unfortunately, Apache errolog truncated the $eventdata variable, I cannot view all its internal detail.
Could you tell me the exact exit command in Moodle, please?
It might be easier to just log the contents to a different file.
You can write a simple function for that, e.g.
$file = fopen($CFG->dataroot . '/myfile.txt', 'a');
fwrite($file, print_r($value, true));
Then just call it with: mylog($eventdata)
Thank you, it works!