Home » IIS » Advanced Logging is not working – Enable Advanced Logging per site

Advanced Logging is not working – Enable Advanced Logging per site

Advanced Logging is an additional IIS feature that helps administrators customizing web server logs. IIS 7, 7.5, and 8 used this feature as a detailed and customized logging option. With IIS 8.5, Enhanced Logging which is a built-in feature in IIS was introduced.

In this post, I will explain a solution for the scenario where Advanced Logging is not recording any logs. I will also provide a trick to enable it per websites.

What to do if Advanced Logging is not working

First of all, check the module in IIS to make sure it’s enabled.

Advanced Logging is not working

If everything looks good on the window above, check your applicationHost.config file. In my case, it was not working because enabled="true" attribute were not present. After adding it as shown below, it started logging.

Advanced Logging is not working applicationHost.config

How to enable or disable Advanced Logging per website

It sounds straightforward but -unfortunately- it isn’t because the suggested solution in the official documentation results in the error below.

There was an error while performing this operation.


The request is not supported. (Exception from HRESULT: 0x80070032)

The request is not supported. (Exception from HRESULT: 0x80070032)

Suggested solution which DOES NOT WORK:

The Advanced Logging feature can be enabled or disabled at the server level in IIS Manager, which also enables or disables logging at lower levels (matching the server-level setting).
1- In the Connections pane, click the Web site or directory for which you want to disable logging.
2- In the Web site or directory Home page, double-click the Advanced Logging icon.
3- In the Advanced Logging feature page, click the log definition, and then in the Actions pane, click Edit Log Definition.
4- In the Log Definition page, clear the Enabled check box.
5- In the Actions pane, click Apply.
6- Repeat steps (3) through (5) for additional log definitions, if desired.

The trick that works

Instead of disabling Advanced Logging per site, you can create a filter for sites that we don’t want logs for.

For example: In my test environment, let’s say I don’t want logs for MigrationTest site. So created a filter as shown below. It doesn’t log for that site anymore (If there is no log file in the folder, it creates a new file. However, it doesn’t log requests in this file)

In order to create a filter to disable logging for a site:

  1. Go to IIS Manager
  2. Click the server name
  3. Double click Advanced Logging
  4. Double click the log definition (%COMPUTERNAME%-Server)
  5. Click Edit Filter
  6. Click Add Expression
  7. From Field list, select Site Name
  8. From Operator list, select Not Equals
  9. In the Value field, type the site name
  10. Click OK to close Edit Log Definition Filter window
  11. Click Apply
  12. Repeat Step 6-9 for the other sites you want to disable logging for
  13. Reset IIS
IIS log definition for Advanced Logging

You can use Advanced Logging to actual client IP address when there is a load balancer in between. Here is how to make this configuration: How to log actual client IP address in IIS?

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.
Categories IIS

1 thought on “Advanced Logging is not working – Enable Advanced Logging per site”

Leave a Comment