How To Use the Event Logging Utility (Logevent.exe) to Create and Log Custom Events in Event Viewer in Windows 2000
This article was previously published under Q315410 On This PageSUMMARY This step-by-step article describes how to use the Event
Logging utility (Logevent.exe) to create and to log custom events to the
Application Log of Event Viewer. Logevent.exe is included in the Windows 2000
Resource Kit. You can start Logevent.exe by using either the command prompt or
a batch file, and you can use the tool to create entries in the Application Log
of either a local or a remote Windows 2000-based computer. Logevent.exe is useful when you want to log error information or status information from batch programs that you run by using logon scripts or by using the AT command. You can call Logevent.exe from a batch file, and then use it to log the information to the Application Log. Logevent.exe can store entries in the logs of other computers; therefore, you can record data in a central location. Overview of Logevent.exeLogevent.exe uses the following syntax:logevent -m \\computername-s severity-c categorynumber-r source-e eventID-t timeout"event text" The following list describes the parameters that you can use with
Logevent.exe:
ExamplesHow to Log an Entry on the Local ComputerTo record an Information entry in the Application Log of the local computer, either use the following line in a batch file or type it at a command prompt, and then press ENTER:
logevent "This is a test" When you view the event details in Event Viewer for this example,
an entry similar to the following is displayed: Date: 01/01/2002 Source: User Event Time: 8:16 Category: None Type: Information Event ID: 1 User: N/A Computer: MYCOMPUTER Description: The description for Event ID ( 1 ) in Source ( User Event) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: This is a test. How to Log an Entry on a Remote ComputerTo log a Warning entry on a remote computer named "Server1," with a category code of 100, and an event ID number of 88, either use the following line in a batch file or type it at the command prompt, and then press ENTER:
logevent -m \\server1 -s W -c 100 -r "my batch program" -e 88 "batch program failed!" When you view the event details in Event Viewer for this example,
an entry similar to the following is displayed: Date: 01/01/2002 Source: my batch program Time: 8:30 Category: (100) Type: Warning Event ID: 88 User: N/A Computer: SERVER1 Description: The description for Event ID ( 88 ) in Source ( my batch program ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: batch program failed! How to View Application Log Events in Event ViewerTo view events in the Application Log of Event Viewer:
REFERENCES For more information about Logevent.exe, type the following
line at the command prompt, and then press ENTER: logevent /? For additional information about how to view and manage logs in
Event Viewer, click the article number below to view the article in the
Microsoft Knowledge Base: 302542 (http://support.microsoft.com/kb/302542/EN-US/) How To Diagnose System Problems with Event Viewer in Microsoft Windows 2000
For more information about the Windows 2000
Resource Kit, visit the following Microsoft Web site: http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/default.mspx (http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/default.mspx) APPLIES TO
| Article Translations
|
Back to the top
