user3025107
user3025107

Reputation: 1

Log Not Found In Event Viewer

String s = "this is an erro message"; 
EventLog log = new EventLog("PragimTech");
log.Source = "PragimTech.com";
log.WriteEntry(s , EventLogEntryType.Error);
Response.Write("Successfully written to event viewer");

I've created the custom logger in the event viewer ("PragimTech"), but when I log anything to it, I can't find the message that I sent, i don't know why , and there are no problems or exceptions appearing, but the message couldn't be found at the event viewer.

Upvotes: 0

Views: 88

Answers (1)

code5
code5

Reputation: 4794

If the Log Source (PragimTech.com) doesn't exist in the Event Logging system, your Web Application under IIS will try to create the source. However, it's more than likely that your application doesn't have creating a log source access which is causing it to fail.

You have a couple of options:

  1. You can manually create the "PragimTech.com" log source; -- preferred
  2. Give your web application creating access to create the Log source; -- not as preferred

Upvotes: 1

Related Questions