Configure failed request tracing

There are two methods for configuring the failed request tracing:

Using the appcmd.exe command

appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].traceFailedRequestsLogging.enabled:True" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].traceFailedRequestsLogging.maxLogFiles:10" /commit:apphost
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].traceFailedRequestsLogging.directory:%SystemDrive%\inetpub\logs\FailedReqLogFiles" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /+"[path='*']"
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /+"[path='*'].traceAreas.[provider='WWW Server',areas='Rewrite',verbosity='Verbose']"
appcmd.exe set config "Default Web Site" -section:system.webServer/tracing/traceFailedRequests /[path='*'].failureDefinitions.statusCodes:"400-599"

Note that the steps above only apply to IIS 7.0 or later, and that the commands work best when cmd.exe is run as an administrator.

Via the IISManager app

  1. In IIS Manager, expand the root node, expand Sites, then select Default Web Site.
    Root node – Sites – Default Web Site
    Root node – Sites – Default Web Site
  2. In the Actions pane on the right, select Failed Request Tracing.
    Actions – Failed Request Tracing
    Actions – Failed Request Tracing
  3. Check the Enable box (mandatory). The Directory target and Maximum number of trace files options can be customized (optional). Click OK when done.
    Edit Website Failed Request Tracing Settings
    Edit Website Failed Request Tracing Settings
  4. Expand Default Web Site, then select the website to be traced.
    Select the website
    Select the website
  5. Double-click on the Failed Request Tracing Rules icon of the selected website.
    Failed Request Tracing Rules
    Failed Request Tracing Rules
  6. In the Actions pane on the right, click on Add to add a new rule.
    Actions – Add
    Actions – Add
  7. Select All content ()*, then click Next.
    Trace all content
    Trace all content
  8. Check the Status Code(s) box, then enter the type of the status code to be traced. In this case, the Status code(s) is set to monitor everything from codes 400 to 599. Click Next when done.
    Status code(s)
    Status code(s)
  9. Select the providers of the tracing. For each provider, set the Verbosity to Verbose and select all Areas. In this case, the WWW Server provider was selected.
    Providers
    Providers
  10. Click Finish. The tracing rule is now defined.
    Defined tracing rule
    Defined tracing rule
Give us Feedback