Log transaction code

Fixes #1825