LogFileName Property
Collapse the table of content
Expand the table of content

DefaultTraceListener.LogFileName Property

 

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 string LogFileName { get; set; }

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.
DefaultTraceListener defaultListener;
defaultListener = new DefaultTraceListener();
Trace.Listeners.Add(defaultListener);

// Assign the log file specification from the command line, if entered.
if (args.Length>=2)
{
    defaultListener.LogFileName = args[1];
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft