First, let's take a look at some concepts of system logs, as shown in:
When writing system logs, you must specify the event source. Then, the system determines the log under which the event source is registered and adds an event to the log. Using the EventLog class, you can easily add an event:
Copy content to clipboardProgramCodeProgram code
EventLog. writeentry ("ABC", "Hello world! ", Eventlogentrytype. Warning); // The default event is under the Application
Next, create a log "Custom Event", register the ABC event source to "Custom Event", and add an event:
Copy the content to the clipboard program code
// The Event source is registered with the event. It is automatically created when the log does not exist.
EventLog. createeventsource ("ABC", "Custom Event ");
// Write event
EventLog. writeentry ("ABC", "Hello world! ", Eventlogentrytype. Warning );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.