Der er ikke noget at gøre så .. jeg har lige checket MSDN Library og en siger at på NT vil der blive skrevet til log systemet, på Win9x til en log fil defineret et eller andet sted ..
i mit MSDN står der følgende: Logs an event in the application\'s log target. On Windows NT platforms, the method writes to the NT Event log. On Windows 95/98 platforms, the method writes to the file specified in the LogPath property; by default, if no file is specified, events will be written to a file named vbevents.log.
Nu har jeg søgt efter vbevents.log men den fil findes ikke... ???? HVORFOR kan man ikke skrive til eventlogen ?? det er noget Pi.
\"On Windows 95/98 platforms, the method writes to the file specified in the LogPath property; by default, if no file is specified, events will be written to a file named vbevents.log.\"
\"vbevents.log\" vil altså kun eksistere hvis du kører Win9x. Ikke Win2K/NT
Har du checket samtlige log filer igennem i 2K ? Der er vist 3 mener jeg .. (eller er det mig der tager fejl ?)
Jeg kopierer fra MSDN Oct 2000: (måske skal du se på LogPath..)
INFO: Event Logging in Visual Basic
-------------------------------------------------------------------------------- The information in this article applies to:
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0 Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0
SUMMARY The App object in Visual Basic has the following methods and properties that facilitate the creation of event logs:
Methods: LogEvent, StartLogging.
Properties: AppMode, AppPath. This article addresses some of the common issues associated with these properties and methods and provides an event logging example that demonstrates their use.
MORE INFORMATION
Common Issues Regarding Event Logging Event logging does not work within the Visual Basic IDE. To enable event logging, you must compile and run a Visual Basic project as an executable.
The LogPath and LogMode properties are read-only. The documentation in books online is incorrect in suggesting that they can be used as L-Values.
You can specify the LogPath and LogMode by using the logTarget and logMode parameters of the StartLogging method respectively.
If LogPath is not specified, the logged entries go to the event log on Windows NT and the VBEvents.log file in the %SystemRoot% directory on Windows 95 and Windows 98.
The Source in the Windows NT Event Viewer for all entries of any Visual Basic application is \"VBRuntime.\" This is by design.
Event Logging Example Create a new a Standard EXE project (Project1) in Visual Basic (Form1 is created by default).
Add two Command buttons to Form1.
Add the following code to Form1\'s code window:
\'=========================== CODE FOR FORM1 ==========================
Private Sub Command1_Click() \'Default logging without specifying LogPath or LogMode. With App .LogEvent \"Default Logging \" & Now, vbLogEventTypeInformation .LogEvent .LogPath .LogEvent .LogMode End With End Sub
Private Sub Command2_Click() \'Logging to a file by specifying LogPath and LogMode \'in the StartLogging method call. With App .StartLogging \"c:\\temp\\logtest.log\", 2 \'LogMode = 2 should be the same as vbLogToFile, \'but vbLogToFile constant is not defined as shown \'in books online. .LogEvent \"Specified Path File Logging \" & Now, vbLogEventTypeInformation .LogEvent .LogPath .LogEvent .LogMode End With End Sub
Private Sub Form_Load() Command1.Caption = \"Default Logging\" Command2.Caption = \"Specified Path\" End Sub \'======================== END OF CODE FOR FORM1 ======================= Compile the project. Run the resulting Executable file, and press the command buttons to generate the logs.
Check the logs. If you are using Windows 2000 or Windows NT, check the default logging with the Event Viewer by selecting Application from the Log menu, then press the F5 key to refresh. If you are using Windows 95 or Windows 98, you can find VBEvents.log in the %SystemRoot% directory on Windows 95 and Windows 98, typically the C:\\Win95 or C:\\Windows directory. The non-default log file (LogTest.log) for both platforms should be in the \"C:\\Temp\" directory.
KB artiklen referer til ASP programmer, dvs de køres ikke af en logged in user. Det skulle ikke være nødvendigt at ændre registreringsdatabasen hvis du kører et selvstændigt program, så vidt jeg kan se. Jeg har ikke adgang til w2k her så jeg kan ikke chekke.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.