EventLog.LogDisplayName プロパティ
アセンブリ: System (system.dll 内)
構文
例外
使用例Dim myRemoteMachine As String Dim myLogName as string = "MyLog" Console.Write("Enter computer on which to create log : ") myRemoteMachine = Console.ReadLine() ' Check if the source exists. if not EventLog.SourceExists("MyTestSource") then 'Create source. EventLog.CreateEventSource("MyTestSource", myLogName ,myRemoteMachine) Console.WriteLine("Creating EventSource") else 'Get the EventLog associated if the source exists. myLogName = EventLog.LogNameFromSourceName("MyTestSource" ,myRemoteMachine) end if Dim myEventLog1 As New EventLog(myLogName, myRemoteMachine) myEventLog1.Source = "MyTestSource" ' Write an entry into log. myEventLog1.WriteEntry("This is for your information", _ EventLogEntryType.SuccessAudit, 100) Console.WriteLine("An EventLog created on computer " + myEventLog1.MachineName) Console.Write("Enter remote computer on which to create log : ") myRemoteMachine = Console.ReadLine() Dim myEventLog2 As New EventLog() myEventLog2.MachineName = myRemoteMachine myEventLog2.Source = "MyTestSource" myEventLog2.Log = myEventLog1.LogDisplayName myEventLog2.WriteEntry("This is for your information") Console.WriteLine("An EventLog created on computer " + myEventLog2.MachineName)
string myRemoteMachine; string myLogName = "MyLog"; Console.Write( "Enter computer on which to create log : " ); myRemoteMachine = Console.ReadLine(); // Check if the source exists. if(!EventLog.SourceExists("MyTestSource")) { //Create source. EventLog.CreateEventSource("MyTestSource", myLogName,myRemoteMachine); Console.WriteLine("Creating EventSource"); } else // Get the EventLog associated if the source exists. myLogName = EventLog.LogNameFromSourceName("MyTestSource",myRemoteMachine); EventLog myEventLog1 = new EventLog(myLogName,myRemoteMachine); myEventLog1.Source = "MyTestSource"; // Write an entry into log. myEventLog1.WriteEntry("This is for your information" , EventLogEntryType.SuccessAudit,100); Console.WriteLine("An EventLog created on computer "+ myEventLog1.MachineName); Console.Write( "Enter remote computer on which to create log : " ); myRemoteMachine = Console.ReadLine(); EventLog myEventLog2 = new EventLog(); myEventLog2.MachineName = myRemoteMachine; myEventLog2.Source = "MyTestSource"; myEventLog2.Log = myEventLog1.LogDisplayName; myEventLog2.WriteEntry("This is for your information"); Console.WriteLine("An EventLog created on computer "+ myEventLog2.MachineName);
String^ myRemoteMachine; String^ myLogName = "MyLog"; Console::Write( "Enter computer on which to create log : " ); myRemoteMachine = Console::ReadLine(); // Check if the source exists. if ( !EventLog::SourceExists( "MyTestSource" ) ) { //Create source. EventLog::CreateEventSource( "MyTestSource", myLogName, myRemoteMachine ); Console::WriteLine( "Creating EventSource" ); } else myLogName = EventLog::LogNameFromSourceName( "MyTestSource", myRemoteMachine ); // Get the EventLog associated if the source exists. EventLog^ myEventLog1 = gcnew EventLog( myLogName,myRemoteMachine ); myEventLog1->Source = "MyTestSource"; // Write an entry into log. myEventLog1->WriteEntry( "This is for your information" , EventLogEntryType::SuccessAudit, 100 ); Console::WriteLine( "An EventLog created on computer {0}", myEventLog1->MachineName ); Console::Write( "Enter remote computer on which to create log : " ); myRemoteMachine = Console::ReadLine(); EventLog^ myEventLog2 = gcnew EventLog; myEventLog2->MachineName = myRemoteMachine; myEventLog2->Source = "MyTestSource"; myEventLog2->Log = myEventLog1->LogDisplayName; myEventLog2->WriteEntry( "This is for your information" ); Console::WriteLine( "An EventLog created on computer {0}", myEventLog2->MachineName );
String myRemoteMachine; String myLogName = "MyLog"; Console.Write("Enter computer on which to create log : "); myRemoteMachine = Console.ReadLine(); // Check if the source exists. if (!(EventLog.SourceExists("MyTestSource"))) { //Create source. EventLog.CreateEventSource("MyTestSource", myLogName, myRemoteMachine); Console.WriteLine("Creating EventSource"); } else { // Get the EventLog associated if the source exists. myLogName = EventLog.LogNameFromSourceName("MyTestSource", myRemoteMachine); } EventLog myEventLog1 = new EventLog(myLogName, myRemoteMachine); myEventLog1.set_Source("MyTestSource"); // Write an entry into log. myEventLog1.WriteEntry("This is for your information" , EventLogEntryType.SuccessAudit, 100); Console.WriteLine("An EventLog created on computer " + myEventLog1.get_MachineName()); Console.Write("Enter remote computer on which to create log : "); myRemoteMachine = Console.ReadLine(); EventLog myEventLog2 = new EventLog(); myEventLog2.set_MachineName(myRemoteMachine); myEventLog2.set_Source("MyTestSource"); myEventLog2.set_Log(myEventLog1.get_LogDisplayName()); myEventLog2.WriteEntry("This is for your information"); Console.WriteLine("An EventLog created on computer " + myEventLog2.get_MachineName());
.NET Framework のセキュリティ
プラットフォーム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に収録されているすべての辞書からEventLog.LogDisplayName プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からEventLog.LogDisplayName プロパティ
を検索
- EventLog.LogDisplayName プロパティのページへのリンク