Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

EventSourceCreationData.LogName Propriedade

Gets or Sets the name of the log de eventos to which the Origem writes Entries.

Namespace:  System.Diagnostics
Assembly:  System (em System. dll)
public string LogName { get; set; }

Valor da propriedade

Tipo: System.String
O nome do log de eventos.This can be Aplicativo, System, or a personalizado Name log.O valor padrão é "Aplicativo".

Use the LogName property to identify the event log that your application writes entries to using the new source.O log de eventos pode ser um novo log ou um log existente.Aplicativos e serviços devem Gravar o Log de aplicativo ou um personalizado log.Drivers de dispositivo devem gravar no log do sistema.If you do not explicitly set the LogName property, the event log defaults to the Application log.

ObservaçãoObservação:

O log de segurança é somente leitura.

To target an existing log for the new source, set the LogName property to the existing event log name.To create a new event log for the source, you must set the LogName property.Os nomes do log de eventos deve consistir em caracteres imprimíveis e não é possível incluir os caracteres ' * ','? ', ou ' \ '.Os primeiros 8 caracteres do nome do log de eventos devem ser diferentes dos primeiros 8 caracteres existentes nomes dos logs de eventos no computador especificado.

O sistema operacional armazena logs de eventos como arquivos.When you use EventLogInstaller or the CreateEventSource method to create a new event log, the associated file is stored in the %SystemRoot%\System32\Config directory on the specified computer.The file name is set by appending the first 8 characters of the LogName property with the ".evt" file name extension.

The seguinte exemplo de código Sets the Properties configuração for an evento origem from linha de comando Arguments.Os argumentos de entrada especificam o nome da fonte de eventos, nome do log de eventos, nome do computador e arquivo de recurso de mensagem de evento.This example is part of a larger example provided for the EventSourceCreationData class.

EventSourceCreationData mySourceData = new EventSourceCreationData("", "");
bool registerSource = true;

// Process input parameters.
if (args.Length > 0)
{
    // Require at least the source name.

    mySourceData.Source = args[0];

    if (args.Length > 1)
    {
        mySourceData.LogName = args[1];
    }

    if (args.Length > 2)
    {
        mySourceData.MachineName = args[2];
    }
    if ((args.Length > 3) && (args[3].Length > 0))
    {
        mySourceData.MessageResourceFile = args[3];
    }
}
else 
{
    // Display a syntax help message.
    Console.WriteLine("Input:");
    Console.WriteLine(" source [event log] [machine name] [resource file]");

    registerSource = false;
}

// Set defaults for parameters missing input.
if (mySourceData.MachineName.Length == 0)
{
    // Default to the local computer.
    mySourceData.MachineName = ".";
}
if (mySourceData.LogName.Length == 0)
{
    // Default to the Application log.
    mySourceData.LogName = "Application";
}


Isso foi útil para você?
(1500 caracteres restantes)

Contribuições da comunidade

ADICIONAR
© 2013 Microsoft. Todos os direitos reservados.