writing to event log

Discussion in 'ASP .Net Security' started by Guest, Jun 23, 2005.

  1. Guest

    Guest Guest

    Hi
    Does any body know how to register my own eventlog source?
    and how to register my own category and eventid for the eventlogentry?


    TIA

    --
    Guest, Jun 23, 2005
    #1
    1. Advertising

  2. Guest

    Parag Guest

    Hi,
    You need to create an object of System.Diagnostics.EventLog. This will enable you to create the event log and write to it.
    The sample code in C# for it could be
    System.Diagnostics.EventLog eventLog =

    new System.Diagnostics.EventLog();

    // Create the source if it does not already exist

    if( !System.Diagnostics.EventLog.SourceExists(

    this._EventLogSource) )

    {

    System.Diagnostics.EventLog.CreateEventSource(

    this._EventLogSource, this._EventLogName);

    }

    // Code for writing to event log.

    Regards,

    Parag Kulkarni

    <dl> wrote in message news:...
    > Hi
    > Does any body know how to register my own eventlog source?
    > and how to register my own category and eventid for the eventlogentry?
    >
    >
    > TIA
    >
    > --
    >
    >
    >
    Parag, Jun 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik_the_boss
    Replies:
    0
    Views:
    2,630
    Henrik_the_boss
    Nov 5, 2003
  2. Ollie
    Replies:
    10
    Views:
    3,189
    pobby69
    Nov 14, 2008
  3. =?Utf-8?B?VG9tIFdpbmdlcnQ=?=

    My.Log.Writeexception not writing to Application Event Log.

    =?Utf-8?B?VG9tIFdpbmdlcnQ=?=, Jan 20, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,354
    =?Utf-8?B?VG9tIFdpbmdlcnQ=?=
    Jan 20, 2006
  4. Tom Wingert
    Replies:
    0
    Views:
    321
    Tom Wingert
    Jan 12, 2006
  5. Replies:
    0
    Views:
    1,266
Loading...

Share This Page