Reputation: 2735
I just deleted my apache error.log file with rm error.log, and wanted create a new one with touch error.log. Now apache is not logging anymore. I read this article afterwards. Very smart..
Is it possible to create a new error.log file or does apache create a new error log when doing a restart?
Upvotes: 2
Views: 3805
Reputation: 3753
You can clear file using the following command
cat > error.log
Please refer this link
Upvotes: 1
Reputation: 1
when apache starts, it opens a "handle" on the log file. if you remove the file, and recreate one, then apache will still write to the old handle and nothong will get appended to the new handle. the correct way to empty a file while a program is using it is to use:
echo "" > /path/to/file
Upvotes: 0
Reputation: 727
Apache should recreate the log file upon restart, if yours isn't doing it maybe apache's user does not have permissions to write in the logs directory.
If you did touch error.log
beign root then apache is not able to write to that log file since its owned by root. Change the ownership to apache's user.
Upvotes: 2