How can you be sure it is not being executed? Perhaps it is being executed, and just not doing what you expect.
Place a writeDump(); and abort; inside the loop to confirm that the loop is being entered. Also, check the qry.recordcount to confirm it is greater than 0.
Alternatively, this would be an excellent place for a step debugger if you have something like Fusion Debug set up.
I think it might be related to the implicit structure calls you have in the runEvent() then. ACF has a bug with those. Try assigning the variables first
var args = {logType =3,logID = 1,Description = ‘Group: #locID2#’,dsn = arguments.DSN};
var locLogDetailID = RunEvent(event=“ehResource.Logger”,eventArguments=args);