Log all errors in error.txt (fix #287).