LoggingSession LoggingSession LoggingSession LoggingSession Class

Definition

Represents the destination of logged messages from LoggingChannel instances.

public : sealed class LoggingSession : ILoggingSession, IClosablepublic sealed class LoggingSession : ILoggingSession, IDisposablePublic NotInheritable Class LoggingSession Implements ILoggingSession, IDisposable// You can use this class in JavaScript.
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)

Initializes a new instance of the LoggingSession class.

public : LoggingSession(PlatForm::String name)public LoggingSession(String name)Public Sub New(name As String)// You can use this method in JavaScript.
Parameters
name
PlatForm::String String String String

The name of the logging session.

Properties

Name Name Name Name

Gets the name of the logging session.

public : PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The session name.

Methods

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

Adds a logging channel to the current logging session.

public : void AddLoggingChannel(ILoggingChannel loggingChannel)public void AddLoggingChannel(ILoggingChannel loggingChannel)Public Function AddLoggingChannel(loggingChannel As ILoggingChannel) As void// You can use this method in JavaScript.
Parameters
loggingChannel
ILoggingChannel ILoggingChannel ILoggingChannel ILoggingChannel

The logging channel to add.

See Also

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.

public : void AddLoggingChannel(ILoggingChannel loggingChannel, LoggingLevel maxLevel)public void AddLoggingChannel(ILoggingChannel loggingChannel, LoggingLevel maxLevel)Public Function AddLoggingChannel(loggingChannel As ILoggingChannel, maxLevel As LoggingLevel) As void// You can use this method in JavaScript.
Parameters
loggingChannel
ILoggingChannel ILoggingChannel ILoggingChannel ILoggingChannel

The logging channel to add.

maxLevel
LoggingLevel LoggingLevel LoggingLevel LoggingLevel

The logging level for loggingChannel.

Remarks

You can also use this function to change the level at which a channel is added to a session; to do so, call AddLoggingChannel, using the existing logging channel, but with the updated level.

See Also

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

Ends the current logging session.

public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.

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

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

This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()

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

Removes the specified logging channel from the current logging session.

public : void RemoveLoggingChannel(ILoggingChannel loggingChannel)public void RemoveLoggingChannel(ILoggingChannel loggingChannel)Public Function RemoveLoggingChannel(loggingChannel As ILoggingChannel) As void// You can use this method in JavaScript.
Parameters
loggingChannel
ILoggingChannel ILoggingChannel ILoggingChannel ILoggingChannel

The logging channel to remove.

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

Saves the current logging session to a file.

public : IAsyncOperation<StorageFile> SaveToFileAsync(IStorageFolder folder, PlatForm::String fileName)public IAsyncOperation<StorageFile> SaveToFileAsync(IStorageFolder folder, String fileName)Public Function SaveToFileAsync(folder As IStorageFolder, fileName As String) As IAsyncOperation( Of StorageFile )// You can use this method in JavaScript.
Parameters
folder
IStorageFolder IStorageFolder IStorageFolder IStorageFolder

The folder that contains the log file.

fileName
PlatForm::String String String String

The name of the log file.

Returns

See Also