I would also question why are you trying to store the workflow log into a Z-table? There should be a really good reason for this, and even then it is most probably wrong.
1) Why do you need to have same data in two places?
2) Depending on the implemented workflow processes, the workflow log table(s) can be really big. Why would you want to replicate even part of this data? Many times the question of deleting & archiving the work items (and the log data) appears sooner or later.
Clearly the place of the custom code is not right, if it does not store correct data into the Z-table. Did you debug this? Are you getting right data in your enhancement spot?
Once you explain the background of this requirement, someone might give you a better solution, and you could forget the whole enhancement spot solution altogether.
Kind regards,
Karri