I just checked: apart from the automated built in tests, the only place that log entry is created is in the quiz_delete_attempt function, and the only place that function is called is from the quiz reports. So, it really has to be user action to generate that log entry.
Thank you so much for looking into this for us Tim. I really appreciate getting clarity around this as it's sometimes difficult to know what's really going on in the bowels of the system and how to respond to Teachers when this happens.
One last question (hopefully )
I'm pretty proficient with Moodle and somewhat proficient with the "bowels" of Moodle. If I wanted to help myself to better understand the mechanics around how the logs are generated, and corresponding functions, are there specific php files that I would look for? Would there be a file for each individual component?
This might be a good idea for the next Moodle certification course:
"Advanced Moodle Admin. Troubleshooting 101: Learn all about the mechanics of what makes Moodle tick. Get inside Moodle's bowels and learn how to perform a simple colonoscopy."
The way log entries are generated is via the event API. Code will create an event with the data to log, then 'trigger' it to cause the log entry to be created. Docs are here, but the are a bit verbose. https://docs.moodle.org/dev/Event_2. The helpful thing to know is that the even classes will always be in places like .../classes/event/event_name.php throughout the Moodle code. So, for example mod/quiz/classes/event/attempt_deleted.php. Then you can search the code for places where that event class is referred to, like https://github.com/moodle/moodle/blob/0e1e1e5586a1f43c951d9a399243220a3ccf882c/mod/quiz/locallib.php#L436.
Hopefully it is clear how what is defined in that class relates to what is written to mdl_logstore_standard_log.
(LOL at the proposed course title.)