ServiceBase.EventLog Propriedade

Definição

Obtém um log de eventos que você pode usar para gravar a notificação de chamadas de comando de serviço, como iniciar e parar, no log de eventos do aplicativo.Gets an event log you can use to write notification of service command calls, such as Start and Stop, to the Application event log.

public:
 virtual property System::Diagnostics::EventLog ^ EventLog { System::Diagnostics::EventLog ^ get(); };
public virtual System.Diagnostics.EventLog EventLog { get; }
[System.ComponentModel.Browsable(false)]
public virtual System.Diagnostics.EventLog EventLog { get; }
member this.EventLog : System.Diagnostics.EventLog
[<System.ComponentModel.Browsable(false)>]
member this.EventLog : System.Diagnostics.EventLog
Public Overridable ReadOnly Property EventLog As EventLog

Valor da propriedade

EventLog

Uma instância de EventLog cuja origem é registrada no log de aplicativo.An EventLog instance whose source is registered to the Application log.

Atributos

Comentários

O construtor inicializa a EventLog propriedade para uma instância com as EventLog.Source EventLog.Log Propriedades e definidas.The constructor initializes the EventLog property to an instance with the EventLog.Source and EventLog.Log properties set. A origem é o ServiceName do serviço e o log é o log do aplicativo do computador.The source is the ServiceName of the service, and the log is the computer's Application log. Esses valores são definidos automaticamente e não podem ser alterados para o registro em log automático de comandos de serviço.These values are set automatically and cannot be changed for automatic logging of service commands.

Quando AutoLog é true , os comandos Iniciar, parar, pausar, continuar e personalizado são gravados automaticamente no log de eventos do aplicativo.When AutoLog is true, Start, Stop, Pause, Continue, and custom commands are recorded automatically in the Application event log. Você também pode usar a EventLog propriedade para gravar mensagens adicionais nesse log.You can use the EventLog property to write additional messages to that log as well. O componente chama o EventLog.WriteEntry uso deste EventLog membro.The component calls EventLog.WriteEntry using this EventLog member.

Para relatar informações para um log de eventos personalizado em vez do log do aplicativo, defina AutoLog para false e escreva instruções dentro dos métodos de manipulação de comandos OnContinue , OnPause ou OnStop para postar no log apropriado.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.

Aplica-se a

Confira também