I deleted error.log file from my logs directory.

As root, I used vi to create error.log file again. root:root owns the file, permissions are -rw-r--r--. Same ownership and permissions as access.log.

Now, no errors are being recorded. Access.log is still being appended to, but not error.log.

Any ideas?

PHP configured to log notices, warnings, errors. I'm using error_log() to trigger error messages as well, but with no luck. Was working up until I removed the log file.

PHP 5.3.10 Apache 2.2.22 Ubuntu 3.11

  • 2
    Delete file, then run apache2ctl graceful May 9, 2014 at 2:12

2 Answers 2


Apache process has an open file descriptor for its log files. If you delete one of them the corresponding file descriptor renders invalid and Apache stops logging. Next time, if you need to empty the log file without restarting Apache you can issue:

# echo > /var/log/apache/access.log

The file will be truncated but Apache won't stop logging.


Well, I feel foolish. I guess all I needed was to restart the service with the file restored.

service apache2 restart

  • 2
    You don't need to restore the file, simple restart is enough. May 9, 2014 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.