rewrite log handler