EventLogSession EventLogSession EventLogSession EventLogSession Class

定義

用來存取本機電腦或遠端電腦上的事件記錄服務,讓您能管理及收集電腦上事件記錄檔和事件提供者的相關資訊。Used to access the Event Log service on the local computer or a remote computer so you can manage and gather information about the event logs and event providers on the computer.

public ref class EventLogSession : IDisposable
public class EventLogSession : IDisposable
type EventLogSession = class
    interface IDisposable
Public Class EventLogSession
Implements IDisposable
繼承
EventLogSessionEventLogSessionEventLogSessionEventLogSession
實作

範例

例如程式碼使用這個類別中,請參閱How To:查詢事件How to:擷取事件發行者的相關資訊How to:設定與讀取事件記錄檔屬性For example code using this class, see How To: Query for Events, How to: Retrieve Information About an Event Publisher or How to: Configure and Read Event Log Properties.

建構函式

EventLogSession() EventLogSession() EventLogSession() EventLogSession()

初始化新的 EventLogSession 物件,並建立與本機事件記錄服務的連線。Initializes a new EventLogSession object, establishes a connection with the local Event Log service.

EventLogSession(String) EventLogSession(String) EventLogSession(String) EventLogSession(String)

初始化新的 EventLogSession 物件,並建立與指定電腦上事件記錄服務的連線。Initializes a new EventLogSession object, and establishes a connection with the Event Log service on the specified computer. 呼叫方法之使用者的認證 (使用者名稱和密碼) 會當做存取遠端電腦的認證來使用。The credentials (user name and password) of the user who calls the method is used for the credentials to access the remote computer.

EventLogSession(String, String, String, SecureString, SessionAuthentication) EventLogSession(String, String, String, SecureString, SessionAuthentication) EventLogSession(String, String, String, SecureString, SessionAuthentication) EventLogSession(String, String, String, SecureString, SessionAuthentication)

初始化新的 EventLogSession 物件,並建立與指定電腦上事件記錄服務的連線。Initializes a new EventLogSession object, and establishes a connection with the Event Log service on the specified computer. 指定的認證 (使用者名稱和密碼) 會當做存取遠端電腦的認證來使用。The specified credentials (user name and password) are used for the credentials to access the remote computer.

屬性

GlobalSession GlobalSession GlobalSession GlobalSession

取得連接本機電腦上事件記錄服務的靜態預先定義工作階段物件。Gets a static predefined session object that is connected to the Event Log service on the local computer.

方法

CancelCurrentOperations() CancelCurrentOperations() CancelCurrentOperations() CancelCurrentOperations()

取消這個工作階段物件所連接之事件記錄服務的任何目前使用中作業 (例如讀取事件記錄檔或訂閱事件記錄檔)。Cancels any operations (such as reading an event log or subscribing to an event log) that are currently active for the Event Log service that this session object is connected to.

ClearLog(String) ClearLog(String) ClearLog(String) ClearLog(String)

從指定的事件記錄檔清除事件。Clears events from the specified event log.

ClearLog(String, String) ClearLog(String, String) ClearLog(String, String) ClearLog(String, String)

從指定的事件記錄檔中清除事件,並將已清除的事件儲存至指定的檔案。Clears events from the specified event log, and saves the cleared events to the specified file.

Dispose() Dispose() Dispose() Dispose()

釋放這個物件所使用的所有資源。Releases all the resources used by this object.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放這個物件所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by this object, and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
ExportLog(String, PathType, String, String) ExportLog(String, PathType, String, String) ExportLog(String, PathType, String, String) ExportLog(String, PathType, String, String)

將事件匯入至外部記錄檔中。Exports events into an external log file. 儲存這些事件時,並不包含事件訊息。The events are stored without the event messages.

ExportLog(String, PathType, String, String, Boolean) ExportLog(String, PathType, String, String, Boolean) ExportLog(String, PathType, String, String, Boolean) ExportLog(String, PathType, String, String, Boolean)

將事件匯入至外部記錄檔中。Exports events into an external log file. 可以設定旗標以指出方法將會繼續匯出事件,即使指定的查詢針對部分記錄發生失敗。A flag can be set to indicate that the method will continue exporting events even if the specified query fails for some logs. 儲存這些事件時,並不包含事件訊息。The events are stored without the event messages.

ExportLogAndMessages(String, PathType, String, String) ExportLogAndMessages(String, PathType, String, String) ExportLogAndMessages(String, PathType, String, String) ExportLogAndMessages(String, PathType, String, String)

將事件和其訊息匯出至外部記錄檔。Exports events and their messages into an external log file.

ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo) ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo) ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo) ExportLogAndMessages(String, PathType, String, String, Boolean, CultureInfo)

將事件和其訊息匯出至外部記錄檔。Exports events and their messages into an external log file. 可以設定旗標以指出方法將會繼續匯出事件,即使指定的查詢針對部分記錄發生失敗。A flag can be set to indicate that the method will continue exporting events even if the specified query fails for some logs. 事件訊息會以指定的語言匯出。The event messages are exported in the specified language.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetLogInformation(String, PathType) GetLogInformation(String, PathType) GetLogInformation(String, PathType) GetLogInformation(String, PathType)

取得物件,這個物件包含指定之事件記錄檔的執行階段資訊。Gets an object that contains runtime information for the specified event log.

GetLogNames() GetLogNames() GetLogNames() GetLogNames()

取得可列舉的集合,包含已在事件記錄服務中註冊的所有事件記錄檔名稱。Gets an enumerable collection of all the event log names that are registered with the Event Log service.

GetProviderNames() GetProviderNames() GetProviderNames() GetProviderNames()

取得可列舉的集合,包含已在事件記錄服務中註冊的所有事件提供者名稱。Gets an enumerable collection of all the event provider names that are registered with the Event Log service. 事件提供者是將事件發行至事件記錄檔的應用程式。An event provider is an application that publishes events to an event log.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱