Fix painful bug in eventlogging code

Change-Id: I3026aadcb28e7a8325137214512163558cccf2db
(cherry picked from commit 3547f179607c1d70de779b8b5d82d8ee76df74a6)