DefaultTraceListener.LogFileName Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the name of a log file to write trace or debug messages to.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

Public Property LogFileName As String

Property Value

Type: System.String

The name of a log file to write trace or debug messages to.

The following code example creates a new DefaultTraceListener, adds it to the Trace.Listeners collection, and sets the LogFileName property to the log file specified in the command-line arguments.

' Create and add a new default trace listener.
Dim defaultListener As DefaultTraceListener
defaultListener = New DefaultTraceListener
Trace.Listeners.Add(defaultListener)

' Assign the log file specification from the command line, if entered.
If args.Length >= 2 Then
    defaultListener.LogFileName = args(1)
End If

.NET Framework
Available since 1.1
Return to top
Show: