none
How to Read error logs for specific application RRS feed

  • Question

  • Hi I'm trying to make a windows form application in c#, that will monitor a application if it sets an error on the event viewer logs

    Example :Application Name Copychimp.exe

    thats what the application name i want to monitor for the current date

    this only what i have tryed

    static void Main(string[] args)
            {
                string eventlofName = "Application";
                EventLog logs = new EventLog();
                logs.Log = eventlofName;
                
                foreach(EventLogEntry log in logs.Entries){
                    Console.WriteLine("{0}\n" + log.Message);
                }
            }

    his is far from what i needed,

    sorry im kinda new at programming


    Monday, October 21, 2019 5:20 AM

All replies

  • Hi I'm trying to make a windows form application in c#, that will monitor a application if it sets an error on the event viewer logs

    Example :Application Name Copychimp.exe

    thats what the application name i want to monitor for the current date

    this only what i have tryed

    static void Main(string[] args)
            {
                string eventlofName = "Application";
                EventLog logs = new EventLog();
                logs.Log = eventlofName;
                
                foreach(EventLogEntry log in logs.Entries){
                    Console.WriteLine("{0}\n" + log.Message);
                }
            }

    this is far from what i needed,

    sorry im kinda new at programming

    Monday, October 21, 2019 5:05 AM
  • Hi Almost,

    Thank you for posting here.

    >>Hi I'm trying to make a windows form application in c#

    Based on your code, I find your program may be a console application. If you want to create a windows form app, you could refer to Create a Windows Forms App project.

    >>will monitor a application if it sets an error on the event viewer logs

    Based on my search, I find that we could not monitor a specific application for event viewer log. Because the source name may be different from application name.

    However, I find the following link could export windows event log for a specific source.

    How to export Windows Event log for a specific source with WMI?

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 21, 2019 8:04 AM
    Moderator
  • hi based on your code i find one web application in this application all login errors are will save in your database and automatically sending this error to your mail id also <p>https://tutorialshelper.com/how-to-sending-logging-errors-to-email-in-mvc/</p>

    Friday, November 8, 2019 2:43 PM