creating the eventlog for visual studio applications

Last post 07-05-2008 4:47 PM by TATWORTH. 14 replies.

Sort Posts:

  • creating the eventlog for visual studio applications

    05-11-2007, 2:31 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

     

    Hello All,

     I am attempting to create the application by which

     I will be able to maintain the history such that

    what errors were occured , how those were resolved and, who has resolved at what time

    is there any component in VS which satisfies above requirements?

    Or how should i proceed?

    Swati

     

     

     

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 4:18 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031
    In thread http://forums.asp.net/thread/1631113.aspx, I posted a untility called MakeLog plus a C# library that includes functions to write to an Event Log. If you need vb.net code, please let me know.
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    05-11-2007, 7:17 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

    Hello ,

     thank u for the reply, but how to invoke this  eventlog functions so that

    when solution is built , errors are recorded to eventlog file  and when errors resolved ,Programmer is able to write that how the errors has been solved

     

    How I can do this?

     

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 7:18 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

    Hello ,

     thank u for the reply, but how to invoke this  eventlog functions so that

    when solution is built , errors are recorded to eventlog file  and when errors resolved ,Programmer is able to write that how the errors has been solved

     

    How I can do this?

     

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 7:30 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

    Try

       CommonData xCommonData = new CommonData();
       string sMethod = System.Reflection.MethodInfo.GetCurrentMethod().Name;
       xCommonData.WriteEventError(MODULE_NAME, sMethod, ex, "");

    MODULE_NAME you need to declare as a constant

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    05-11-2007, 7:46 AM
    • Loading...
    • iamindrak
    • Joined on 05-11-2007, 11:43 AM
    • Posts 12

    Hey swati might this can help you,

     

    using System;
    using System.Diagnostics;
    using System.Threading;
                 
    class MySample{

        public static void Main(){
       
            // Create the source, if it does not already exist.
            if(!EventLog.SourceExists("MySource"))
            {
                 //An event log source should not be created and immediately used.
                 //There is a latency time to enable the source, it should be created
                 //prior to executing the application that uses the source.
                 //Execute this sample a second time to use the new source.
                EventLog.CreateEventSource("MySource", "MyNewLog");
                Console.WriteLine("CreatedEventSource");
                Console.WriteLine("Exiting, execute the application a second time to use the source.");
                // The source is created.  Exit the application to allow it to be registered.
                return;
            }
                   
            // Create an EventLog instance and assign its source.
            EventLog myLog = new EventLog();
            myLog.Source = "MySource";
           
            // Write an informational entry to the event log.   
            myLog.WriteEntry("Writing to event log.");
           
        }
    }

    Regards,

    Indrajeet

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 7:48 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

     

    Hi Tatworth, 

    But How I can automate  &  synchronize the process

    so that whenever solution is built ,eventlog file will be generated automaticaly

     

    Swati Jain

     

     

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 8:05 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

    You compile the MakeLog to an EXE and run it using a batch script as is documented in the program source.

    Echo off
    MakeLog Custom1
    PAUSE

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    05-11-2007, 8:30 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

    Hi Tatworth,

    Will u plz detail the process step by step again?

     compile the MakeLog to an EXE and run it using a batch script as is documented in the program source.

    Echo off
    MakeLog Custom1
    PAUSE

    thank u once again , Tatworth for your replies

    Swati

  • Re: creating the eventlog for visual studio applications

    05-11-2007, 9:11 AM
    Answer
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031
    You have the source to MakeLog. You need to compile it. Create a BATCH script call RUNMAKELOG.BAT setting required name of the log instead of Custom1. Run this batch script and follow the instructions.
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    03-26-2008, 6:01 PM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

     There is an updated (for VS2005) version of MakeLog posted at http://forums.asp.net/p/1207886/2255745.aspx#2255745

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    05-12-2008, 7:19 AM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

    Make Log is now part of the CommonData project on CodePlex at http://www.codeplex.com/CommonData

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    05-12-2008, 7:57 AM
    • Loading...
    • Swati Jain
    • Joined on 05-24-2006, 12:29 PM
    • Pune
    • Posts 711

    Hi Tatworth,

    Is the  source code  available . I have seen the url but not finding how its exactly implemented.

    Swati

  • Re: creating the eventlog for visual studio applications

    05-12-2008, 6:16 PM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

     The Zip file for MakeLog contains both source and an EXE.- have you downloaded the ZIP file?

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: creating the eventlog for visual studio applications

    07-05-2008, 4:47 PM
    • Loading...
    • TATWORTH
    • Joined on 02-04-2003, 8:34 AM
    • England
    • Posts 7,031

     The CommonData functions have now been released on CodePlex as http://www.codeplex.com/CommonData/Release/ProjectReleases.aspx?ReleaseId=15049

    This includes unit tests of the functions.
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Page 1 of 1 (15 items)