Hello to all and best wishes
Everything is in the title, I want to create an event log in my own company and in which I can incorporate my own alerts through eg eventcreate
Thank you for your help
regards
Hello to all and best wishes
Everything is in the title, I want to create an event log in my own company and in which I can incorporate my own alerts through eg eventcreate
Thank you for your help
regards
You can use the EventLog class to create a custom event log on a local or remote computer. You might create a custom log if you wanted to organize your entries in a more granular way than is allowed when your components write entries to the default Application log. For example, suppose you have a component called OrderEntry that writes entry information to an event log. You are interested in backing up and saving these entries for a longer period of time than some other entries in the Application log. Rather than registering your component to write to the Application log, you can create a custom log called OrdersLog and register your component to write entries to that log instead. That way, all of your order information is stored in one place and will not be affected if the entries in the Application log are cleared.
You can indirectly use the CreateEventSource method to create a custom log. This method creates a new source and lets you specify the log to write to. If you specify that you want to write to a log that does not already exist, the system automatically creates a custom log for you and registers your component as a source for that log.
Hello,
For event everything goes in:
HKLM \ System \ CurrentControlSet \ Services \ EventLog \
So we need an entry, for example in vbscript:
Set WshShell = WScript.CreateObject ( "WScript.Shell")
WshShell.RegWrite _
"HKLM \ System \ CurrentControlSet \ Services \ EventLog \" monEvt
To create a custom event log
Call the CreateEventSource method and specify the source string and the name of the log file you want to create.
The following example shows how to create a custom log called MyNewLog on the local computer. This code assumes that an Imports or using statement exists for the System.Diagnostics namespace:
Visual Basic
C#EventLog.CreateEventSource("ApplicationName", "LogName")
To create a custom event log on a remote computer, specify the computer name as a third parameter. The following code shows an example.System.Diagnostics.EventLog.CreateEventSource("ApplicationName", "LogName");
Visual Basic
Dim creationData As New EventSourceCreationData("ApplicationName", "LogName")
creationData.MachineName = "ServerName"
EventLog.CreateEventSource(creationData)
C#
System.Diagnostics.EventSourceCreationData creationData = new
System.Diagnostics.EventSourceCreationData("ApplicationName", "LogName");
creationData.MachineName = "ServerName";
EventLog.CreateEventSource(creationData);
Just use Win32 Event log apis
"CreateEventSource () method" doesn't exist.
It's only for .NET and wraps Win32 api (then for kids only who don't know win32 programming...)
Bookmarks