Delete IIS log files

iis-7log-fileswindows-server-2008-r2

I do not find a way to disable and delete log file at C:\inetpub\logs\LogFiles\W3SVC2\u_extend1.log

The file is extremely large about 50gb, I have tried to delete it as administrator, but got an error that the file is used by System.

I thought that this file is generated by IIS7, disabled IIS7 and logging, restarted Windows but still file is use. Please help?!

Best Answer

  1. Stop the IIS Admin and World Wide Web Publishing services either via the command line or the services.msc console to unlock the file (obviously this will stop IIS, so if you are hosting production sites do this in a maintenance window).
  2. Delete the file.
  3. Configure logging options as documented by Microsoft.

If for some reason you still show it as in use, use Process Explorer to find the process using it. Select Find->File Handle or DLL and enter the file name.