Log.WriteEntry Method (String, TraceEventType)
Writes a message to the application's log listeners.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
The WriteEntry method writes a message to the application's event log listeners.
In client applications, the Log object is available through the My.Application.Log object. In Web applications, the Log object is available through the My.Log object.
To learn which log listeners receive the WriteEntry method's messages, see Walkthrough: Determining Where My.Application.Log Writes Information (Visual Basic). You can change default log listeners. For more information, see Working with Application Logs in Visual Basic.
For overloads that do not take the id argument, the id written to the log is defined by the following table.
The following table lists examples of tasks involving the WriteEntry method.
Write event information to the application's log listeners
Determine where Log writes information
Availability by Project Type
Windows Control Library
Web Control Library
This example shows how to use the My.Application.Log.WriteEntry method to log tracing information. For more information, see How to: Write Log Messages (Visual Basic).
This code example can run only within a client application. Change My.Application.Log.WriteEntry to My.Log.WriteEntry for Web applications.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.