Adds logging to help track down primary key violation