I want to create a batch file to clear my Apache error log files, because they keep getting large very quickly. I tried using the following script:
@echo off
type NUL > C:\Program Files\Apache Software Foundation\Apache2.2\logs\access.log
type NUL > C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log
Unfortunately, this script doesn't work. I am using Windows 7. Any suggestions?
Won't work - Apache keeps the log files open at all times. You'd have to stop Apache, THEN truncate, and restart Apache. Another option would be to use a log rotater to do this for you automatically.