語言

ServiceBase.AutoLog 屬性

定義

指示是否要在事件日誌中回報 Start、Stop、Pause 和 Continued 指令。

public:
 property bool AutoLog { bool get(); void set(bool value); };
public bool AutoLog { get; set; }
[System.ServiceProcess.ServiceProcessDescription("SBAutoLog")]
public bool AutoLog { get; set; }
member this.AutoLog : bool with get, set
[<System.ServiceProcess.ServiceProcessDescription("SBAutoLog")>]
member this.AutoLog : bool with get, set
Public Property AutoLog As Boolean

屬性值

true在活動日誌中回報資訊;否則,。 false

屬性

備註

AutoLog設定指示true服務使用應用程式事件日誌來回報指令失敗,以及服務中開始、停止、暫停和繼續事件的狀態變更資訊。 服務名稱作為日誌 EventLog.Source的名稱。

若要將資訊報告至自訂事件日誌而非應用程式日誌,請設定 AutoLog 並 false 撰寫指令於指令處理方法 OnContinue中 OnPause,或 OnStop 將 發佈至相應的日誌。

Note

ServiceName提供事件日誌來源字串的 必須先設定,服務才嘗試寫入事件日誌。 在設定來源名稱之前嘗試存取事件日誌會拋出例外。

適用於

另請參閱