Share via


Enable or Disable Logging (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Enable logging for a server when you want IIS to selectively log only certain requests to a server based on configured criteria. As soon as server logging is enabled, you can enable selective logging for any site on the server. You can also then view the log file to see which requests are failing and which requests are succeeding.

Disable logging for a site when you no longer want IIS to log requests to a site selectively.

Note

By default, logging is enabled in IIS 7.

Prerequisites

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Logging Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To enable or disable logging

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

User Interface

To use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click Logging.

  3. On the Logging page, in the Actions pane, click Enable to enable logging or click Disable to disable logging.

Command Line

To enable logging, use the following syntax:

appcmd set config /section:httpLogging /dontLog:False

To disable logging, use the following syntax:

appcmd set config /section:httpLogging /dontLog:True

Note

When you use Appcmd.exe to configure the <httpLogging> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

Configuration

The procedure in this topic affects the following configuration elements:

<httpLogging>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

See Also

Concepts

Configuring Logging in IIS 7
Configure Per-Site Logging Options at the Server Level (IIS 7)
Configure Logging Options at the Site Level (IIS 7)
Configure Per-Server Logging Options (IIS 7)
Select W3C Fields to Log (IIS 7)
Configure Log File Rollover Options (IIS 7)