共用方式為


LogSection 類別1

設定伺服器或月臺的記錄。

Syntax

class LogSection : ConfigurationSection  

方法

下表列出 類別所 LogSection 公開的方法。

名稱 描述
GetAllowDefinition (繼承自 ConfigurationSection.)
GetAllowLocation (繼承自 ConfigurationSection。)
RevertToParent (繼承自 ConfigurationSection。)
SetAllowDefinition (繼承自 ConfigurationSection。)
SetAllowLocation (繼承自 ConfigurationSection。)

屬性

下表列出 類別所 LogSection 公開的屬性。

名稱 描述
CentralBinaryLogFile 讀取/寫入 CentralBinaryLogFile 值,指定伺服器上所有月臺的集中式二進位記錄設定。
CentralLogFileMode 讀取/寫入 sint32 值,指定伺服器的集中式記錄模式。 可能的值稍後會列在一節中。
CentralW3CLogFile 可讀寫 的 CentralW3CLogFile 值,指定伺服器上所有月臺 (W3C) 集中式記錄的設定。
Location (繼承自 ConfigurationSection .) 索引鍵屬性。
LogInUTF8 讀取/寫入 boolean 值。 true 如果 IIS 記錄 UCS 轉換格式 8 中的所有字串, (UTF-8) ;否則為 false 。 預設值為 true。 此設定會將全伺服器套用至所有文字模式記錄。
Path (繼承自 ConfigurationSection .) 索引鍵屬性。
SectionInformation (繼承自 ConfigurationSection。)

子類別

這個類別不包含子類別。

備註

這個類別會對應至 <system.applicationHost/log> ApplicationHost.config 中的 區段。

下表列出 屬性的可能值 CentralLogFileMode 。 預設值為 0 (Site) 。

關鍵字 描述
0 Site 所有用戶端要求都會記錄在月臺層級,而不是在伺服器層級集中記錄。 每個月臺都會產生記錄檔。
1 CentralBinary 所有月臺的所有用戶端要求都會記錄到伺服器上的集中式二進位格式的單一記錄檔。
2 CentralW3C 所有月臺的所有用戶端要求都會記錄到伺服器上的 W3C 集中式格式的單一記錄檔。

範例

下列程式碼範例會顯示 屬性的值 CentralLogFileMode 。 協助程式函式會將列舉值轉譯為文字。

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject( _  
    "winmgmts:root\WebAdministration")  
  
' Get the log section.  
Set oSection = oWebAdmin.Get("LogSection.Path=" & _  
    "'MACHINE/WEBROOT/APPHOST',Location=''")  
  
' Display the class name of the section.  
WScript.Echo "[ " & oSection.Path_.Class & " ]"  
  
' Display the path and location.  
WScript.Echo "Path: " & oSection.Path  
WScript.Echo "Location: " & oSection.Location  
  
' Display the central log file mode.  
WScript.Echo "CentralLogFileMode: " & _  
                GetModeText(oSection.CentralLogFileMode)  
  
' ==== GetModeText helper function. ====  
Function GetModeText(intMode)  
    Select Case intMode  
        Case 0  
            GetModeText="Site"  
        Case 1  
            GetModeText="CentralBinary"  
        Case 2  
            GetModeText="CentralW3C"  
        Case Else  
            GetModeText="Undefined value"  
    End Select  
End Function  
  

繼承階層架構

ConfigurationSection

LogSection

規格需求

類型 描述
Client - Windows Vista 上的 IIS 7.0
- Windows 7 上的 IIS 7.5
- Windows 8 上的 IIS 8.0
- Windows 10上的 IIS 10.0
伺服器 - Windows Server 2008 上的 IIS 7.0
- Windows Server 2008 R2 上的 IIS 7.5
- Windows Server 2012 上的 IIS 8.0
- Windows Server 2012 R2 上的 IIS 8.5
- Windows Server 2016上的 IIS 10.0
產品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 檔案 WebAdministration.mof

另請參閱

ConfigurationSection 類別
CentralBinaryLogFile 類別
CentralW3CLogFile 類別
SiteLogFile 類別