Share via


Visual Basic Reference

StartLogging Method

See Also    Example    Applies To

Sets the log target and log mode of an operation. 

Syntax

object.StartLogging logTarget, logMode

Part Description
object An object expression that evaluates to an object in the Applies To list.
logTarget Path and filename of the file used to capture output from the LogEvent method.
logMode A value which determines how logging (through the LogEvent method) will be carried out. See Settings below.

Settings

The settings for logMode are:

Constant Value Description
vbLogAuto 0 If running on Windows 95 or later, this option logs messages to the file specified in the LogFile property. If running on Windows NT, messages are logged to the Windows NT Application Event Log, with "VBRunTime" used as the application source and App.Title appearing in the description.
VbLogOff 1 Turns all logging off. Messages from UI shunts as well as from the LogEvent method are ignored and discarded.
VbLogToFile 2 Forces logging to a file. If no valid filename is present in LogPath, logging is ignored, and the property is set to vbLogOff.
VbLogToNT 3 Forces logging to the NT event log. If not running on Windows NT, or the event log is unavailable, logging is ignored and the property is set to vbLogOff.
VbLogOverwrite 16 Indicates that the logfile should be recreated each time the application starts. This value can be combined with other mode options using the OR operator. The default action for logging is to append to the existing file. In the case of NT event logging, this flag has no meaning.
VbLogThreadID 32 Indicates that the current thread ID be prepended to the message, in the form "[T:0nnn] ". This value can be combined with other mode options using the OR operator. The default action is to show the thread ID only when the application is multi-threaded (either explicitly marked as thread-safe, or implemented as an implicit multithreaded app, such as a local server with the instancing property set to Single-Use, multithreaded).