implement error_log. remove trailing whitespace