HttpLoggingSection Class1
Configures the logging of HTTP requests.
Syntax
class HttpLoggingSection : ConfigurationSection
Methods
The following table lists the methods exposed by the HttpLoggingSection
class.
Name | Description |
---|---|
GetAllowDefinition | (Inherited from ConfigurationSection.) |
GetAllowLocation | (Inherited from ConfigurationSection .) |
RevertToParent | (Inherited from ConfigurationSection .) |
SetAllowDefinition | (Inherited from ConfigurationSection .) |
SetAllowLocation | (Inherited from ConfigurationSection .) |
Properties
The following table lists the properties exposed by the HttpLoggingSection
class.
Name | Description |
---|---|
DontLog |
A read/write boolean value. true if logging is disabled for successful requests; false if successful requests are logged. A request is considered successful if its status code is less than 400. The default is false . Note: This property is the same as the DontLog metabase property in IIS 6.0. |
Location |
(Inherited from ConfigurationSection .) A key property. |
Path |
(Inherited from ConfigurationSection .) A key property. |
SectionInformation |
(Inherited from ConfigurationSection .) |
SelectiveLogging |
A sint32 enumeration that specifies the events to log. The possible values are listed later in the Remarks section. |
Subclasses
This class contains no subclasses.
Remarks
This class corresponds to the <system.webServer/httpLogging>
section in the ApplicationHost.config file.
The following table lists the possible values for the SelectiveLogging
property. The default is 0 (LogAll
).
Value | Keyword | Description |
---|---|---|
0 | LogAll |
All requests are logged. |
1 | LogSuccessful |
Only successful requests are logged. A request is considered successful if its status code is less than 400. |
2 | LogError |
Only failed requests are logged. A request is considered failed if its status code is greater than or equal to 400. |
Example
The following code example sets the SelectiveLogging
property to LogError
.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject( _
"winmgmts:root\WebAdministration")
' Get the HTTP logging section.
Set oSection = oWebAdmin.Get( _
"HttpLoggingSection.Path=" & _
"'MACHINE/WEBROOT/APPHOST',Location=''")
' Display the class name of the section.
WScript.Echo "[ " & oSection.Path_.Class & " ]" & vbCrLf
' Display the initial settings.
Call DisplaySettings("Initial Values", oSection)
' Set the SelectiveLogging property to LogError.
oSection.SelectiveLogging = 2
' Save new values to configuration.
oSection.Put_
' Refresh the oSection object variable with new values.
oSection.Refresh_
' Show changed settings.
Call DisplaySettings("New Values", oSection)
' ==== DisplaySettings helper function. ====
Function DisplaySettings(HeadingText, oSection)
' Display a heading.
WScript.Echo String(Len(HeadingText), "-")
WScript.Echo HeadingText
WScript.Echo String(Len(HeadingText), "-")
' Display configuration history section properties.
WScript.Echo "Path: " & oSection.Path
WScript.Echo "Location: " & oSection.Location
WScript.Echo "DontLog: " & oSection.DontLog
WScript.Echo "SelectiveLogging: " & _
oSection.SelectiveLogging
WScript.Echo
End Function
Inheritance Hierarchy
HttpLoggingSection
Requirements
Type | Description |
---|---|
Client | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF file | WebAdministration.mof |
See Also
CentralBinaryLogFile Class
CentralW3CLogFile Class
ConfigurationSection Class
OdbcLoggingSection Class
LogSection Class
SiteLogFile Class
DontLog Metabase Property (IIS 6.0)