How to Generate Log in VB.NET

Log file generation is very useful in your system to put errors and exceptions in a file. This blog shows how to add a logging feature to a Windows application.

First, you need a copy the Log.Dll file to your project (Download attached file).

Then add reference to Log.Dll by right click on the project, select Add Reference and browse the DLL. 

Now we use Dll in our form.

Declare Namespace.

Imports Log.Log

 After declare namespace you can use writelog function.

You want to print any exception message in log file then use writelog()

WriteLog(ex.ToString(), EventLogEntryType.Error) 

You want to print only message in log file.

WriteLog(“Function Start”)




Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now