IIS logging, write to log file more often

iislogging

How can I configure IIS to write to log file more often, it does so every 2 minutes.
This is my development server, there's no load on it, and I want it to write right away, how can I configure it so it checks more often if it has stuff to write and writes it.

Maybe through the registry? IIS configuration editor? WMI?

Best Answer

running windows 2008? if so, issuing the following will help :

netsh http flush logbuffer 

in iis 6 (windows 2003) you can try :

the following was taken from (http://www.it-notebook.org/iis/article/flush_log.htm)

The IIS 6.0 logs are handled by HTTP.sys. For performance and scalability reasons, HTTP.sys buffers the logging for a while before it writes to disk. By default, the buffer time is one (1) minute, and the buffer size is 64 K. When debugging, and this depends on the log files, it could however be great to not buffer. There is no supported way to do this, but an unsupported way is to create the registry value DisableLogBuffering and set it to 1.

Registry Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\DisableLogBuffering
Data Type: REG_DWORD
Range: 0 - 1
Note: The key does not exist by default. The value 1 means that log buffering is disabled. 0 means that it is enabled.

After you have created this value, and/or changed its data, you need to restart the machine.

You should NOT do this on a production server, it will cause problems.

The registry value LogBufferSize overrides the default logging buffer of 64 K. This can be done to reduce memory consumption (but will increase CPU and hard disk use).

Registry Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Http\Parameters\LogBufferSize
Data Type: REG_DWORD
Range: 12,288 - 65,536