Why is IIS logging to two different folders?
The reasons and solutions for recording IIS logs to two different folders are as follows: 1. Multiple sites or applications have individual log paths configured, which can be set uniformly in the IIS manager; 2. The paths are inconsistent due to application pool identity permissions or shared configurations, and the paths need to be standardized and the permissions are checked; 3. Custom log paths in code or web.config, and the log settings in the configuration file and code are checked. Verifying the above configuration can solve the problem of log dispersion.
If you're seeing IIS (Internet Information Services) logging to two different folders, it's not a bug — it's usually due to how IIS is configured. This behavior often catches admins off guard, especially when troubleshooting or setting up log collection systems. Here's why it might be happening and what you can do about it.

Multiple Sites or Applications in IIS
One of the most common reasons IIS logs go to different folders is that you're running multiple websites or applications under the same server. Each site or application in IIS can have its own logging path configured independently.
- For example, if you have a main site (
Default Web Site
) and an API hosted under a separate application (/api
), each can be configured to write logs to different folders. - You can check this by opening IIS Manager, selecting each site or app, and looking at the Logging feature.
To fix or standardize this:

- Go to each site/application in IIS Manager
- Double-click "Logging"
- Set the same directory path under "Log file name" if you want logs in one place
- Make sure the application pool identity has write access to that folder
Application Pools and Shared Configurations
Another possible cause is the use of shared configurations or multiple application pools . If you're using shared configuration (like in a web farm), or if multiple application pools are involved, the logging paths might not be consistent unless explicitly configured.
- Application pools can affect how and where logs are written, especially if the identity running the pool doesn't have permissions to the desired log folder.
- Also, if you're using a shared configuration across multiple servers, each server might be writing logs locally to its own folder.
To avoid confusion:

- Standardize the logging path across all servers/sites
- Use UNC paths if centralized logging is the goal
- Check permissions on the log folder for the application pool identity
Custom Logging Paths in Web.config or Code
Sometimes the reason is not visible in IIS Manager at all — it might be set programmatically or through configuration files like web.config
.
- If your application uses custom HTTP modules or middleware (eg, in ASP.NET Core), logging behavior can be overridden in code.
- Also, some third-party modules or frameworks might change the logging destination dynamically.
To investigate:
- Look for any logging-related configuration in
web.config
- Search for references to
logFile
orlogging
in code or configuration files - If using ASP.NET Core, check
Program.cs
orStartup.cs
for logging setup
In short, IIS logs going to two different folders usually come down to how sites, applications, or configurations are set up. Once you look at each site's logging settings and check for custom or programmatic overrides, you'll usually find the cause.
The above is the detailed content of Why is IIS logging to two different folders?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

ToenableandcustomizedirectorybrowsinginIIS,firstinstallandenabletheDirectoryBrowsingfeatureviaServerManagerandIISManager;next,customizetheappearanceusingheaderandfooterHTMLsnippets;thenconfiguredefaultdocumentstopreventunintendeddirectorylistings;fin

SharedconfigurationinIISallowsmultipleserverstouseacentralizedapplicationHost.configfile,ensuringconsistencyacrossawebfarm.1.Itenablesallserverstopointtoasharedconfigurationlocation.2.SetupinvolvesusingaUNCpath,enablingthefeatureinIISManager,andimpor

appcmd.exe is a command line tool that comes with IIS7 and above, which can be used to efficiently manage IIS. 1. Can be used to manage sites and applications, such as starting and stopping sites (such as appcmdstopsite/site.name:"MySite"), list running sites, and add or delete applications. 2. Configurable application pools, including creating (appcmdaddapppool/name:MyAppPool), setting .NETCLR version (appcmdsetapppool/apppool.name:MyAppPool/managedRuntimeVersion:v4

Frequently asked questions about IIS servers after Windows update can be solved through the following steps: 1. If the IIS service cannot be started, check the service status and event log, try to restart the service or re-register/install IIS; 2. When the application pool crashes abnormally, check the application log, confirm the .NET version and permission settings, try to reset the identity or use the built-in account; 3. When the website has HTTP500 errors or blank pages, enable detailed error information, check the module configuration, and test the location problem through local browsing and simple pages; 4. When SSL binding or certificate fails, verify the binding configuration, certificate trust and private key permissions, detect port conflicts, and use tools to test the SSL connection, and rebind the certificate or update the root certificate if necessary.

Enabling Gzip and Brotli compression can improve website performance. The configuration steps are as follows: 1. Enable static and dynamic content compression in IIS; 2. Modify the web.config file to enable Gzip compression and adjust dynamic compression settings; 3. Download and install the Brotli module and configure the relevant MIME types; 4. Use browser developer tools to verify whether Content-Encoding is effective; 5. Pay attention to issues such as MIME type coverage, cache impact, HTTPS compatibility, and server resource occupation. After correct configuration, it can effectively reduce the amount of data transmitted and speed up page loading.

TosetupcustomerrorpagesinIIS,firstenablecustomerrorsintheweb.configfileunderthesection,thenspecifyeachstatuscodewithitscorrespondingerrorpage.1.Edittheweb.configfilewithinyoursiterootorapplicationfolder.2.SeterrorModeto"Custom"anddefineerro

To enable and configure IIS's HTTPRedirect module to implement 301 or 302 redirect, you need to complete the following steps in turn: First, enable the HTTPRedirect module in the Windows function; then select the site or page in the IIS manager, double-click "HTTPRedirect" to set the target URL and select the redirect type (permanent or temporary); finally pay attention to avoid conflicts with other modules, clear browser cache, ensure correct permissions, and achieve more granular control through the web.config file.

Configuring idle timeouts and recycling plans for application pools in IIS optimizes performance and resource management. 1. Idle timeout is used to close the application pool when there is no request. The default is 90 minutes, which is suitable for low access scenarios. If the settings are too short, it may cause the first access delay. It is recommended to adjust according to traffic. If the intranet system is set to 30 minutes, the external network will remain the default or longer. Operation steps include opening the IIS manager, selecting the application pool, and modifying the "Idle timeout (minutes)". 2. Regular recycling can release resources during low peak periods and prevent leakage. It is usually set to 2 a.m. Enable "overlapping recycling" to reduce interruptions; the setting method is to add recycling time points in "Advanced Settings". 3. It is recommended to analyze the request frequency and resource usage in combination with logs and monitoring, continuously optimize the configuration and ensure stability
