Decode log message before encoding (copy from work_type_guesser)
Log exceptions in render_POST (copy from work_type_guesser)