4

この問題は、Windows Server 2008 R2 で発生しました。

カスタム アプリケーション ログがあります。「MyCustomLog」と名付けましょう。このイベント ログは、1 分間に数百のエントリを受け取ります。それらのいくつかは警告またはエラーです。イベントを出力するためのシンプルなコンソール アプリを作成しました。

class Program
{
    static void Main(string[] args)
    {
        EventLog eventLog = new EventLog("MyCustomLog", Environment.MachineName);
        eventLog.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten);
        eventLog.EnableRaisingEvents = true;

        Console.ReadLine();
    }

    private static void OnEntryWritten(object sender, EntryWrittenEventArgs e)
    {
        if (e.Entry.EntryType == EventLogEntryType.Error
            || e.Entry.EntryType == EventLogEntryType.Warning)
        {
            Console.WriteLine();
            Console.WriteLine("Now Date:" + DateTime.Now);
            Console.WriteLine("Received:" + e.Entry.TimeWritten);
            Console.WriteLine(e.Entry.Message);
        }
    }
}

時々EntryWritten、過去のイベントを処理します。つまり、前日かそこらのイベントを意味します...

なぜそれが起こるのですか?私は何が欠けていますか?

更新:アプリケーション出力の例を次に示します。

Now Date:2013-10-02 15:05:04
Received:2013-10-01 10:20:02
<Some Data>


Now Date:2013-10-02 15:05:04
Received:2013-10-01 10:20:08
<Some Data>


Now Date:2013-10-02 15:05:04
Received:2013-10-01 10:20:49
<Some Data>


Now Date:2013-10-02 15:05:04
Received:2013-10-01 10:20:54
<Some Data>
4

1 に答える 1