To start logging to a file:
App.StartLogging <path to file>, vbLogToFile
To send information to the file:
App.LogEvent Message, vbLogEventTypeInformation
or
App.LogEvent Message, vbLogEventTypeError
To stop thye logging:
App.StartLogging <path to file>, vbLogOff
You can also log to the NT log event and I beleive a couple of other places, Just change the contant when you start logging.
Remember that this will only work outside the VB IDE. So if you run your project from VB no error logging will be done. Create the exe and run it outside Vb to see the logging.
The writing to the log has been covered by zemp and robctech. There is more to it than that, but they have covered the stuff you can use without getting deep into API world.
Reading the event log is a real pain, but if you wish to do it I suggest strongm's proof on concept code as a starter. Its link thread222-395506
Take Care
Matt
If at first you don't succeed, skydiving is not for you.
Reading the windows event log is complicated. I took the easy way out. I log or write the errors or events that I want to log to a text file and then use shell to open notepad and I can view the "log file".
I also use this for programs run by clients so that they can easily email me the log file if they are having problems.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.