LoggingSession クラス

定義

LoggingChannel インスタンスからログに記録されるメッセージの送信先を表します。

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
継承
Object Platform::Object IInspectable LoggingSession
属性
実装

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

注釈

LoggingSession クラスを使用して、アプリの実行時にメッセージとデータをメモリ内循環バッファーに記録します。 SaveToFileAsync メソッドを使用して、バッファーをファイルに保存します。 ログ ファイルは、Windows Performance Toolkit (WPT) やその他のユーティリティ (tracerpt.exe など) を使用して表示できます。

LoggingSession インスタンスは、 SaveToFileAsync メソッドが呼び出されるまで、ログに記録されたメッセージをメモリに保持します。 これにより、アプリがメモリ内メッセージを保存するまで、イベントをオンデマンドで保存できます。

LoggingChannel インスタンスを LoggingSession に追加し、LoggingSession インスタンス メソッドを呼び出して、チャネルの削除、破棄、その他の操作の実行を行います。

LoggingSession では、最新の 260 KB のイベントが記録され、その後、古いイベントの上書きが開始されます。

同じ名前のセッションを複数持つことはできません。 さらに、各アプリは合計 4 セッションに制限されます。

コンストラクター

LoggingSession(String)

LoggingSession クラスの新しいインスタンスを初期化します。

プロパティ

Name

ログ セッションの名前を取得します。

メソッド

AddLoggingChannel(ILoggingChannel)

現在のログ 記録セッションにログ チャネルを追加します。

AddLoggingChannel(ILoggingChannel, LoggingLevel)

指定したログ レベルのログ チャネルを現在のログ セッションに追加します。

Close()

現在のログ 記録セッションを終了します。

Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

RemoveLoggingChannel(ILoggingChannel)

指定したログ チャネルを現在のログ セッションから削除します。

SaveToFileAsync(IStorageFolder, String)

現在のログ セッションをファイルに保存します。

適用対象

こちらもご覧ください