Refine error_log handling