Share via


EventSourceCreationData.LogName 속성

정의

소스가 엔트리를 쓰는 이벤트 로그 이름을 가져오거나 설정합니다.

public:
 property System::String ^ LogName { System::String ^ get(); void set(System::String ^ value); };
public string LogName { get; set; }
member this.LogName : string with get, set
Public Property LogName As String

속성 값

이벤트 로그 이름입니다. 이 이름에는 애플리케이션, 시스템 또는 사용자 지정 로그 이름을 사용할 수 있습니다. 기본값은 "Application"입니다.

예제

다음 코드 예제에서는 명령줄 인수에서 이벤트 원본에 대 한 구성 속성을 설정 합니다. 입력 인수는 이벤트 원본 이름, 이벤트 로그 이름, 컴퓨터 이름 및 이벤트 메시지 리소스 파일을 지정합니다. 이 예제는에 대해 제공 된 큰 예제의 일부는 EventSourceCreationData 클래스입니다.

EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( "","" );
bool registerSource = true;

// Process input parameters.
if ( args->Length > 1 )
{
   
   // Require at least the source name.
   mySourceData->Source = args[ 1 ];
   if ( args->Length > 2 )
   {
      mySourceData->LogName = args[ 2 ];
   }

   if ( args->Length > 3 )
   {
      mySourceData->MachineName = args[ 3 ];
   }

   if ( (args->Length > 4) && (args[ 4 ]->Length > 0) )
   {
      mySourceData->MessageResourceFile = args[ 4 ];
   }
}
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";
}
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";
}
         Dim mySourceData As EventSourceCreationData = new EventSourceCreationData("", "")
         Dim registerSource As Boolean = 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)
 
             End If
             If args.Length > 2

                 mySourceData.MachineName = args(2)
 
             End If
             If args.Length > 3 AndAlso args(3).Length > 0

                 mySourceData.MessageResourceFile = args(3)
 
             End If

         Else 
             ' Display a syntax help message.
             Console.WriteLine("Input:")
             Console.WriteLine(" source [event log] [machine name] [resource file]")

             registerSource = False
         End If

         ' Set defaults for parameters missing input.
         If mySourceData.MachineName.Length = 0
         
             ' Default to the local computer.
             mySourceData.MachineName = "."
         End If
         If mySourceData.LogName.Length = 0
             ' Default to the Application log.
             mySourceData.LogName = "Application"
         End If

설명

사용 된 LogName 애플리케이션에 새 소스를 사용 하 여 항목을 쓰도록 이벤트 로그를 식별 하는 속성입니다. 이벤트 로그는 새 로그 또는 기존 로그일 수 있습니다. 애플리케이션 및 서비스 애플리케이션 로그 나 사용자 지정 로그에 작성 해야 합니다. 디바이스 드라이버는 시스템 로그에 작성 해야 합니다. 명시적으로 설정 하지 않으면 경우는 LogName 속성, 이벤트 로그의 애플리케이션 로그에 기본값.

참고

보안 로그에는 읽기 전용입니다.

새 원본에 대한 기존 로그를 대상으로 지정하려면 속성을 기존 이벤트 로그 이름으로 설정합니다 LogName . 원본에 대한 새 이벤트 로그를 만들려면 속성을 설정 LogName 해야 합니다. 이벤트 로그 이름은 인쇄 가능한 문자로 구성되어야 하며 '*', '?', '\' 문자를 포함할 수 없습니다. 이벤트 로그 이름의 처음 8자는 지정된 컴퓨터에서 이벤트 로그의 기존 이름의 처음 8자와 달라야 합니다.

이벤트 로그는 운영 체제에 파일로 저장됩니다. 사용 하는 경우 EventLogInstaller 또는 CreateEventSource 메서드가 새 이벤트 로그에 연결된 된 파일을 만들도록 하는 지정한 컴퓨터의 %SystemRoot%\System32\Config 디렉터리에 저장 됩니다. 파일 이름은의 처음 8 개 문자를 추가 하 여 설정 됩니다는 LogName ".evt" 파일 이름 확장명을 가진 속성입니다.

적용 대상

추가 정보