Įvykiai
03-17 21 - 03-21 10
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabarŠi naršyklė nebepalaikoma.
Atnaujinkite į „Microsoft Edge“, kad pasinaudotumėte naujausiomis funkcijomis, saugos naujinimais ir techniniu palaikymu.
You can use the My.Application.Log
and My.Log
objects to log information about events that occur in your application. This example shows how to use the My.Application.Log.WriteEntry
method with the Startup
and Shutdown
events to write tracing information.
Have a project selected in Solution Explorer. On the Project menu, choose Properties.
Click the Application tab.
Click the View Application Events button to open the Code Editor.
This opens the ApplicationEvents.vb file.
Have the ApplicationEvents.vb file open in the Code Editor. On the General menu, choose MyApplication Events.
On the Declarations menu, choose Startup.
The application raises the Startup event before the main application runs.
Add the My.Application.Log.WriteEntry
method to the Startup
event handler.
My.Application.Log.WriteEntry("Application started at " &
My.Computer.Clock.GmtTime.ToString)
Have the ApplicationEvents.vb file open in the Code Editor. On the General menu, choose MyApplication Events.
On the Declarations menu, choose Shutdown.
The application raises the Shutdown event after the main application runs, but before it shuts down.
Add the My.Application.Log.WriteEntry
method to the Shutdown
event handler.
My.Application.Log.WriteEntry("Application shut down at " &
My.Computer.Clock.GmtTime.ToString)
You can use the Project Designer to access the application events in the Code Editor. For more information, see Application Page, Project Designer (Visual Basic).
Private Sub MyApplication_Startup(
ByVal sender As Object,
ByVal e As ApplicationServices.StartupEventArgs
) Handles Me.Startup
My.Application.Log.WriteEntry("Application started at " &
My.Computer.Clock.GmtTime.ToString)
End Sub
Private Sub MyApplication_Shutdown(
ByVal sender As Object,
ByVal e As System.EventArgs
) Handles Me.Shutdown
My.Application.Log.WriteEntry("Application shut down at " &
My.Computer.Clock.GmtTime.ToString)
End Sub
.NET atsiliepimas
.NET yra atvirojo kodo projektas. Pasirinkite saitą, kad pateiktumėte atsiliepimą:
Įvykiai
03-17 21 - 03-21 10
Prisijunkite prie meetup serijos, kad sukurtumėte keičiamo dydžio DI sprendimus, pagrįstus realaus pasaulio naudojimo atvejais, su kolegomis kūrėjais ir ekspertais.
Registruotis dabarMokymas
Modulis
Capture Web Application Logs with App Service Diagnostics Logging - Training
Learn about how to capture trace output from your Azure web apps. View a live log stream and download logs files for offline analysis.
Dokumentacija
How to: Log Exceptions - Visual Basic
Learn more about: How to: Log Exceptions in Visual Basic
Working with Application Logs - Visual Basic
Learn more about: Working with Application Logs in Visual Basic
How to: Write Log Messages - Visual Basic
Learn more about: How to: Write Log Messages (Visual Basic)
My.Application.Log Object - Visual Basic
Learn more about: My.Application.Log Object