[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1195
  • Last Modified:

In C#, When we create the custom event log through windows service, Where does the eventlog gets stored?

I created a windows service. Through windows service, I created a custom event log and i'm writing the exceptions into the log.
But i'm wondering, Where does the event log gets stored?

If you look  at the application, security event log files, each is associated with a physical location llike (C:\WINDOWS\system32\config\AppEvent.Evt ),
So the question is, How do I associate a custom event log to a physical file OR Where does the custom event log gets stored?

2 Solutions
If u want your Servie Info to be stored in a Custom Event Log then u need to do this in your Windows Service Code

private EventLog evntLog;

public Service1()
      EventLog.CreateEventSource("Custom", "CustomLog");
evntLog = new EventLog(" ");
evntLog.Source = "Custom";

so when u run your service and want to check your custom Log..Navigate to ControlPanel >> Administrative Tools >> Event Viewer There u can find CustomLog and on clciking inisde u will find your Cutome Log


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now