8

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?

GenEric35
  • 223
  • 1
  • 3
  • 6

2 Answers2

11

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
johnh
  • 595
  • 4
  • 9
  • thanks for the thorough answer, using IIS 7.5 on windows 7, the netsh http flush logbuffer command works fine, as for the reg key, to disable buffering, it doesn't seem to take effect on IIS 7.5, even after reboot, but the netsh command will do for now, until I can find the reg key equivalent for IIS 7.5, thanks again – GenEric35 Oct 19 '10 at 13:31
  • btw, to make it easier to call, I dropped a batch file I called iisflush.bat in system32 containing the netsh commands, and I call it from the start menu – GenEric35 Oct 19 '10 at 13:37
0

The command line from johnh is excellent. The following may also help someone. http://blogs.iis.net/bills/archive/2007/05/01/building-an-iis7-sql-logging-module-with-net.aspx

Valamas
  • 365
  • 1
  • 4
  • 9