Your Ad Here

Home Articles | Tutorials | Troubleshooting | Tweaks | Windows Server 2012 | Subsribe to RSS Feed Subscribe to RSS Affiliated sites

Follow me  Follow gusac on Twitter  Subscribe  Email  Subscribe to RSS


Your Ad Here

LogEvent.exe – Utility to create custom events in the event log

29.Oct.2010 | by Gusac | Filed in: Articles, Tutorials

Event Logging utilty or the Logevent.exe is another utility provided by Microsoft to manually generate the event ids. We have discussed EventCreate utility in the previous blog, there is  slight difference between both of them.

Eventcreate lets you generate event id between the range of 0 – 1000 only whereas with LogEvent you can use the integers from 0 – 65535.  Also, EventCreate.exe lets you create events in either System or Application logs while LogEvent events are registered only in the Application log.

The Logevent.exe is a command line utility and is included in the Wiindows 2000 Resource Kit. Though it is meant for Windows 2000, it seems to be working on Windows 7 and 2008 R2 as well. I don't guarantee it success but you can give it a chance.

The syntax for the LogEvent.exe utility is:

LogEvent -M \\computernameS  <Severity> C <CategoryNumber> –R <Source> –E <EventID> –T <TimeOut> Event Description

where -M \\computername is the computer on which you want to generate the event id. If omitted, the event will be registered on the local machine.

S  <Severity> is the Severity Level of the Event ID. Options are: W (Warning), I (Information), S (Success), E (Error), F (Failure). If omitted, Information will be selected by default.

C <CategoryNumber> is the category number for the logged event. If omitted, the number 0 will be displayed.

–R <Source> is the Source of Event being generated. If the value contains space, please enclosed the string in quotes. If this value is omitted, the default value User Event will be used as source for the event.

–E <EventID> is the Event ID for the event.  Value can range from 0 to 65535. If omitted, default value of 1 is used.

–T <TimeOut> is the time duration logevent.exe waits to create the event log entry. If omitted, default value of 60,000 milliseconds is used.

Event Description is the actual text of the Event log entry. This must be enclosed in quotes.

Example:

In the example below, we have created an Error event log with category 10 and Source as Winplat. the event description is: “This is a test error message”

image

Another example, where we have omitted all the parameters, would create a simple event log with Category as 1, Source as User Event and with Event id 1

image

 

Note: With LogEvent.exe utility, event log entries are created only in the Application log.