Event source

Discussion in 'ASP .Net' started by tshad, Sep 23, 2008.

  1. tshad

    tshad Guest

    I am trying change the log that my application writes to from Application to
    a new log. But since I already have started writing to the Application
    log - I get the error:

    The source 'Repos' is not registered in log 'Repos'. (It is registered in
    log 'Application'.) " The Source and Log properties must be matched, or you
    may set Log to the empty string, and it will automatically be matched to the
    Source

    My code is doing:

    string source;
    string log;
    string eventMessage;
    string machine;

    source = "Repos";
    log = "Repos";
    eventMessage = message;
    machine = ".";

    if (!EventLog.SourceExists(source, machine))
    EventLog.CreateEventSource(source, log, machine);

    EventLog eLog = new EventLog(log, machine, source);
    eLog.WriteEntry(eventMessage, eventType);

    I should be able to fix it by removing the source by:

    EventLog.DeleteEventSource("Repos")

    But how to I determine what log the source is registered to?

    I can tell if the Source exists, but how do I tell what it is registered to?

    Thanks,

    Tom
     
    tshad, Sep 23, 2008
    #1
    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. ~~~ .NET Ed ~~~
    Replies:
    1
    Views:
    4,218
    Cowboy \(Gregory A. Beamer\)
    Feb 26, 2005
  2. Marcus Leon
    Replies:
    5
    Views:
    606
    Marcus Leon
    Feb 3, 2005
  3. Cloud Burst
    Replies:
    11
    Views:
    1,088
  4. Author Tarun Tyagi
    Replies:
    0
    Views:
    735
    Author Tarun Tyagi
    Dec 29, 2004
  5. Guido Belligoi
    Replies:
    2
    Views:
    437
    Guido Belligoi
    Oct 19, 2006
Loading...

Share This Page