LoggingSession class

Applies to Windows and Windows Phone

Represents the destination of logged messages from LoggingChannel instances.

Syntax


var loggingSession = new Windows.Foundation.Diagnostics.LoggingSession();

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06030000)]

Members

The LoggingSession class has these types of members:

Constructors

The LoggingSession class has these constructors.

ConstructorDescription
LoggingSession Initializes a new instance of the LoggingSession class.

 

Methods

The LoggingSession class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
AddLoggingChannel(ILoggingChannel) Adds a logging channel to the current logging session.
AddLoggingChannel(ILoggingChannel, LoggingLevel) Adds a logging channel with the specified logging level to the current logging session.
Close [C++, JavaScript]Ends the current logging session.
Dispose [C#, VB]Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
RemoveLoggingChannel Removes the specified logging channel from the current logging session.
SaveToFileAsync Saves the current logging session to a file.

 

Properties

The LoggingSession class has these properties.

PropertyAccess typeDescription

Name

Read-onlyGets the name of the logging session.

 

Remarks

Use the LoggingSession class to log messages and data to an in-memory circular buffer as your app runs. Use the SaveToFileAsync method to save the buffer to a file. You can view the log files by using the Windows Performance Toolkit (WPT) and other utilities like tracerpt.exe.

LoggingSession instances keep logged messages in memory until the SaveToFileAsync method is called. This enables on-demand saving of events until the app saves the in-memory messages.

Add LoggingChannel instances to a LoggingSession, and call LoggingSession instance methods to remove channels, dispose, and perform other operations.

Requirements

Minimum supported client

Windows 8.1 [Windows Store apps only]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Foundation.Diagnostics
Windows::Foundation::Diagnostics [C++]

Metadata

Windows.winmd

See also

Object
LoggingChannel
ILoggingSession
IClosable

 

 

Show:
© 2014 Microsoft