LoggingSession Class

Definition

Represents the destination of logged messages from LoggingChannel instances.

public ref class LoggingSession sealed : ILoggingSession, IClosable
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingSessionFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class LoggingSession final : ILoggingSession, IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.Diagnostics.ILoggingSessionFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class LoggingSession final : ILoggingSession, IClosable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingSessionFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class LoggingSession : System.IDisposable, ILoggingSession
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.Diagnostics.ILoggingSessionFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class LoggingSession : System.IDisposable, ILoggingSession
function LoggingSession(name)
Public NotInheritable Class LoggingSession
Implements IDisposable, ILoggingSession
Inheritance
Object Platform::Object IInspectable LoggingSession
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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.

LoggingSession records the most recent 260KB of events, after which it will begin overwriting older events.

You cannot have more than one session with the same name. In addition, each app is limited to 4 sessions total.

Constructors

LoggingSession(String)

Initializes a new instance of the LoggingSession class.

Properties

Name

Gets the name of the logging session.

Methods

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()

Ends the current logging session.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

RemoveLoggingChannel(ILoggingChannel)

Removes the specified logging channel from the current logging session.

SaveToFileAsync(IStorageFolder, String)

Saves the current logging session to a file.

Applies to

See also