Create and Log event Log in Windows server using .NET

92
Views
1
Answers

How to create a Event Log for my application instead of writing it to the Application Event Log which is default one. Can I write it from C# .Net?

edit | flag
Mad Maddy
Asked on: Jan 27, 2012 at 3:27AM

1 Answers

105
4
105

To allow the ASP.NET account access to create an event source, you need to have read permission on this and all sub keys, and write permission on the event to which you want to create the event source.

You can use the

 EventLog.CreateEventSource()

method which attempts to search Event Sources under all event logs, not just the event log for which you want to create the source.

Follow these steps to create a event Log

  1. To create the new log. Open up regedit and navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog

  • Right click on the Eventlog key and
    click New > Key

  • Name this new key the same name you want your new event log to be named.

  • You can always rename it by editing the string value data in the registry if you like.
  • Now you need to add Sources to your new event log. Right click in the right window pane under your new key and add a new Multi-String value called “Sources” and add the name of each of your applications on each line
  • Thats it! your Log is created.
edit | flag
Gokul A
Answered on: Jan 27, 2012 at 3:37AM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags