EventLog.Entries プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventLog.Entries プロパティの意味・解説 

EventLog.Entries プロパティ

イベント ログ内容取得します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public ReadOnly Property
 Entries As EventLogEntryCollection
Dim instance As EventLog
Dim value As EventLogEntryCollection

value = instance.Entries
public EventLogEntryCollection Entries { get;
 }
public:
property EventLogEntryCollection^ Entries {
    EventLogEntryCollection^ get ();
}
/** @property */
public EventLogEntryCollection get_Entries ()
public function get Entries
 () : EventLogEntryCollection

プロパティ
イベント ログのエントリを保持する EventLogEntryCollection。1 つのエントリが EventLogEntry クラス1 つインスタンス関連付けられます。

解説解説

イベント ログ読み取るときに、Entries メンバ使用します

Entries読み取り専用であるため、このプロパティ使用してエントリを変更したり、ログ書き込んだりすることはできません。代わりに Source指定し、WriteEntry を呼び出して新しログ エントリを書き込みますEntries使用してイベント ログ内のエントリ数をカウントしたり、コレクション内のEventLogEntry表示したできますインデックス付きItem メンバ使用すると、MessageCategory、TimeWritten、EntryType などの特定のエントリについての情報取得できます

ログから読み取るだけの場合Source指定する要はありません。指定できるのは、EventLog インスタンスLog 名のプロパティと MachineName (サーバー コンピュータ名) プロパティだけです。どちらの場合も、Entries メンバには自動的にイベント ログのエントリ リスト設定されます。このリストの項目に対応する適切なインデックス選択することで、個別のエントリを読み取ることができます

ログ エントリの読み取りと書き込み重要な相違は、読み取りのときに読み取りメソッド明示的に呼び出す必要がないことです。LogMachineName指定すると、Entries プロパティによって自動的にエントリが設定されます。Log プロパティまたは MachineName プロパティの値を変更した場合は、次回読み取りEntries プロパティが再び設定されます。

メモメモ

ログ接続している場合MachineName指定する要はありません。MachineName指定しなかった場合は、ローカル コンピュータ "." が想定されます。

使用例使用例

ローカル コンピュータ上のイベント ログ "MyNewLog" のエントリを読み取る例を次に示します

Option Strict
Option Explicit

Imports System
Imports System.Diagnostics
Imports Microsoft.VisualBasic

Class MySample
    Public Shared Sub Main()
        
        Dim myLog As New
 EventLog()
        myLog.Log = "MyNewLog"
        Dim entry As EventLogEntry
        For Each entry In
  myLog.Entries
            Console.WriteLine((ControlChars.Tab & "Entry:
 " & entry.Message))
        Next entry
    End Sub ' Main
End Class ' MySample
using System;
using System.Diagnostics;
              
class MySample{

    public static void Main(){

        EventLog myLog = new EventLog();
        myLog.Log = "MyNewLog";                      
        foreach(EventLogEntry entry in myLog.Entries){
            Console.WriteLine("\tEntry: " + entry.Message);
        }    
    }       
}
   
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
int main()
{
   EventLog^ myLog = gcnew EventLog;
   myLog->Log = "MyNewLog";
   System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      EventLogEntry^ entry = safe_cast<EventLogEntry^>(myEnum->Current);
      Console::WriteLine( "\tEntry: {0}", entry->Message );
   }
}

import System.*;
import System.Diagnostics.*;
import System.Collections.*;

class MySample
{
    public static void main(String[]
 args)
    {
        EventLog myLog = new EventLog();
        myLog.set_Log("MyNewLog");
        EventLogEntry entry;
        IEnumerator objEnum = myLog.get_Entries().GetEnumerator();
        while (objEnum.MoveNext()) {
            entry = (EventLogEntry)objEnum.get_Current();
            Console.WriteLine("\tEntry: " + entry.get_Message());
        }
    } //main
} //MySample
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EventLog クラス
EventLog メンバ
System.Diagnostics 名前空間
EventLogEntryCollection
EventLogEntry
Source
Log
MachineName
WriteEntry



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EventLog.Entries プロパティ」の関連用語

EventLog.Entries プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventLog.Entries プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS