Export (0) Print
Expand All

ServiceBase.AutoLog Property

Indicates whether to report Start, Stop, Pause, and Continue commands in the event log.

[Visual Basic]
Public Property AutoLog As Boolean
[C#]
public bool AutoLog {get; set;}
[C++]
public: __property bool get_AutoLog();
public: __property void set_AutoLog(bool);
[JScript]
public function get AutoLog() : Boolean;
public function set AutoLog(Boolean);

Property Value

true to report information in the event log; otherwise, false.

Remarks

Setting AutoLog to true instructs the service to use the Application event log to report command failures, as well as state change information for Start, Stop, Pause, and Continue events on the service. The name of the service is used as the log's EventLog.Source.

To report information to a custom event log rather than the Application log, set AutoLog to false and write instructions within the command-handling methods OnContinue, OnPause, or OnStop to post to the appropriate log.

Note   The ServiceName, which supplies the source string for the event log, must be set before the service attempts to write to the event log. Trying to access the event log before the source name is set throws an exception.

Requirements

Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ServiceBase Class | ServiceBase Members | System.ServiceProcess Namespace | EventLog | OnStart | OnStop

Show:
© 2014 Microsoft