By default, IIS uses buffered logging which writes logs to disk every 120 seconds (2 minutes). This is a performance optimization for production servers, but can be frustrating during development when you need immediate visibility into log data.
There are several ways to control how frequently IIS flushes logs to disk:
Method 1: Using IIS Configuration Editor
1. Open IIS Manager
2. Select the server node in the connections pane
3. Open "Configuration Editor" from the Management section
4. Navigate to:
system.applicationHost/sites/siteDefaults/logFile
5. Set "bufferFlushInterval" to "00:00:01" (1 second)
6. Click "Apply"
Method 2: Using AppCmd
appcmd.exe set config -section:system.applicationHost/sites /[name=''].logFile.bufferFlushInterval:"00:00:01" /commit:apphost
Method 3: Registry Modification (Advanced)
For granular control, you can modify registry settings:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters]
"LogBufferSize"=dword:00000000
"LogFileFlushInterval"=dword:00000001
After making changes, confirm the settings took effect:
# PowerShell command to check current settings
Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/siteDefaults/logFile" -name "bufferFlushInterval"
While setting a very low flush interval is fine for development, be aware that:
- Frequent disk writes may impact performance under heavy load
- For production environments, the default 2-minute interval is recommended
- SSD-based servers handle frequent flushes better than HDDs
For development purposes, you might prefer streaming logs instead:
# PowerShell command to tail IIS logs
Get-Content -Path "C:\inetpub\logs\LogFiles\W3SVC1\u_ex*.log" -Wait -Tail 30
By default, IIS (Internet Information Services) buffers log entries and writes them to disk every 120 seconds (2 minutes). This is designed for production environments to optimize disk I/O performance. However, during development or debugging, you might want to see log entries immediately.
The most effective way to modify this behavior is through the Windows Registry. Here's how to force IIS to flush logs immediately:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters] "FlushLogBuffers"=dword:00000001 "FlushLogTimer"=dword:00000001
After making these changes, you'll need to restart the HTTP service or reboot your server:
net stop http /y net start w3svc
If you prefer not to modify the registry directly, you can use the IIS command-line tool:
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/log /centralLogFile.flushInterval:00:00:01 /commit:apphost
To confirm your changes took effect, check the applicationHost.config file located at:
%windir%\system32\inetsrv\config\applicationHost.config
Look for the centralLogFile section which should now show:
While these changes are useful for development, be aware that:
- Frequent disk writes may impact performance on busy servers
- SSD wear may become a concern with constant writing
- Default settings should be restored before moving to production
You can verify the changes are working by:
# PowerShell command to monitor log file changes Get-Content C:\inetpub\logs\LogFiles\W3SVC1\u_ex[datetime].log -Wait