LoggingSession LoggingSession LoggingSession LoggingSession LoggingSession Class

Definition

Represents the destination of logged messages from LoggingChannel instances.

public : sealed class LoggingSession : ILoggingSession, IClosable
struct winrt::Windows::Foundation::Diagnostics::LoggingSession : ILoggingSession, IClosable
public sealed class LoggingSession : ILoggingSession, IDisposable
Public NotInheritable Class LoggingSession Implements ILoggingSession, IDisposable
var loggingSession = new loggingSession(name);
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

Initializes a new instance of the LoggingSession class.

Properties

Name Name Name Name Name

Gets the name of the logging session.

Methods

AddLoggingChannel(ILoggingChannel) AddLoggingChannel(ILoggingChannel) AddLoggingChannel(ILoggingChannel) AddLoggingChannel(ILoggingChannel) AddLoggingChannel(ILoggingChannel)

Adds a logging channel to the current logging session.

AddLoggingChannel(ILoggingChannel, LoggingLevel) AddLoggingChannel(ILoggingChannel, LoggingLevel) AddLoggingChannel(ILoggingChannel, LoggingLevel) AddLoggingChannel(ILoggingChannel, LoggingLevel) AddLoggingChannel(ILoggingChannel, LoggingLevel)

Adds a logging channel with the specified logging level to the current logging session.

Close() Close() Close() Close() Close()

Ends the current logging session.

Dispose() Dispose() Dispose() Dispose() Dispose()

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

RemoveLoggingChannel(ILoggingChannel) RemoveLoggingChannel(ILoggingChannel) RemoveLoggingChannel(ILoggingChannel) RemoveLoggingChannel(ILoggingChannel) RemoveLoggingChannel(ILoggingChannel)

Removes the specified logging channel from the current logging session.

SaveToFileAsync(IStorageFolder, String) SaveToFileAsync(IStorageFolder, String) SaveToFileAsync(IStorageFolder, String) SaveToFileAsync(IStorageFolder, String) SaveToFileAsync(IStorageFolder, String)

Saves the current logging session to a file.

See also