TraceFailedRequestsLogging Class [IIS 7 and higher]

Configures the trace logging of failed requests for a Web site.

Syntax

class TraceFailedRequestsLogging : EmbeddedObject

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the TraceFailedRequestsLogging class.

Name

Description

CustomActionsEnabled

A read/write boolean value. true if custom actions are enabled; otherwise, false. The default is false.

NoteNote:
For more information about custom actions, see the CustomActionExe property of the TraceUrl class.

Directory

A read/write string value that specifies where the log files are saved. The default is "%SystemDrive%\inetpub\FailedReqLogFiles".

Enabled

A read/write boolean value. true if trace logging of failed requests is enabled for the Web site; otherwise, false. The default is false.

MaxLogFiles

A read/write uint32 value that specifies the maximum number of log files to persist for the Web site. One log file is created for each failed request that is defined. The default is 50.

MaxLogFileSizeKB

A read/write uint32 value that specifies the maximum size, in kilobytes, of the log file to save to disk. The default is 512. 0 specifies that no limit is used.

NoteNote:
The actual log file size may vary somewhat from the specified size when the memory cache is saved to disk.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the TraceFailedRequestsLogging property of the Site class and the SiteElementDefaults class.

Example

The following example displays the properties of the TraceFailedRequestsLogging class, reverses the value of the Enabled property and saves it, and then displays the properties again to reveal the change.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")

' List the name of each property and display the property values.
For Each vProp In oSite.TraceFailedRequestsLogging.Properties_
    WScript.Echo vProp.Name & ": " & vProp.Value
Next
WScript.Echo 

' Switch the current value of the Enabled property.
oSite.TraceFailedRequestsLogging.Enabled = _
    Not(oSite.TraceFailedRequestsLogging.Enabled)

' Save the change.
oSite.Put_

' Display the property names and values again.
For Each vProp In oSite.TraceFailedRequestsLogging.Properties_
    WScript.Echo vProp.Name & ": " & vProp.Value
Next

Inheritance Hierarchy

EmbeddedObject

   TraceFailedRequestsLogging

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

EmbeddedObject Class [IIS 7 and higher]

Site Class [IIS 7 and higher]

SiteElementDefaults Class [IIS 7 and higher]

TraceUrl Class [IIS 7 and higher]