Add a mechanism to log private data from exceptions

@alainjobart @liguo