EventSourceCreationData.Source プロパティ
アセンブリ: System (system.dll 内)

Dim instance As EventSourceCreationData Dim value As String value = instance.Source instance.Source = value
エントリのソースとしてイベント ログに登録する名前。既定値は空の文字列 ("") です。

ソース名には、通常はアプリケーションの名前か、アプリケーションが大規模な場合はコンポーネントの名前を指定します。EventLog.CreateEventSource(EventSourceCreationData) メソッドは、Source、LogName、および MachineName の各プロパティを使用して、新しいソースおよび関連するイベント ログの登録先のコンピュータでレジストリ値を作成します。新しいソース名は、登録先のコンピュータの既存のソース名または既存のイベント ログ名と異なっている必要があります。
ソースのレジストリ値が作成されると、アプリケーションはそのソースを使用して、エントリを構成済みのイベント ログに書き込むことができます。
各ソースは、同時に 1 つのイベント ログだけに書き込むことができます。ただし、アプリケーションは複数のソースを使用して、複数のイベント ログに書き込むことができます。たとえば、アプリケーションには、異なるイベント ログまたは異なるリソース ファイル用に構成された複数のソースが必要になる場合があります。

コマンド ライン引数からイベント ソースの構成プロパティを設定するコード例を次に示します。入力引数は、イベント ソース名、イベント ログ名、コンピュータ名、およびイベント メッセージ リソース ファイルを指定します。このコード例は、EventSourceCreationData クラスのトピックで取り上げているコード例の一部分です。
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
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"; }
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"; }


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEventSourceCreationData.Source プロパティを検索する場合は、下記のリンクをクリックしてください。

- EventSourceCreationData.Source プロパティのページへのリンク