Represents the destination of logged messages from LoggingChannel instances.
var fileLoggingSession = new Windows.Foundation.Diagnostics.FileLoggingSession();
The FileLoggingSession class has these types of members:
The FileLoggingSession class has these constructors.
|FileLoggingSession||Initializes a new instance of the FileLoggingSession class.|
The FileLoggingSession class has these events.
|LogFileGenerated||Raised when a log file is saved.|
The FileLoggingSession class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
|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.|
|CloseAndSaveToFileAsync||Ends the current logging session and saves it to a file.|
|Dispose [C#, VB]||Performs tasks associated with freeing, releasing, or resetting unmanaged resources.|
|RemoveLoggingChannel||Removes the specified logging channel from the current logging session.|
The FileLoggingSession class has these properties.
|Read-only||Gets the name of the logging session.|
Use the FileLoggingSession class to log messages and data to a file continuously as your app runs. You can view the log files by using the Windows Performance Toolkit (WPT) and other utilities like tracerpt.exe.
Add LoggingChannel instances to a FileLoggingSession, and call FileLoggingSession instance methods to remove channels, dispose, and perform other operations.
FileLoggingSession instances keep logged messages in memory until the CloseAndSaveToFileAsync method is called. This enables on-demand saving of events until the app saves the in-memory messages.
The FileLoggingSession class sends logged messages to disk files as they are logged. The FileLoggingSession class uses sequential logging, which means that all messages are sent to a disk file, and a sequential history of messages is retained. This is distinct from the LoggingSession class, which sends logged messages to disk on-demand, and this happens when there's a problem and the immediate history of in-memory messages is needed for analysis.
Use the FileLoggingSession class when you know that all messages need to be saved, usually over a long period of time, and when the app can't be burdened with on-demand saving steps. Like theLoggingSession class, LoggingChannel instances are added to a FileLoggingSession instance, and the FileLoggingSession instance has methods to remove channels and dispose. FileLoggingSession instances are initialized with a delegate to a new file callback, which notifies the app when a log file rollover has occurred. The feature invokes the delegate when the current internal log file has reached capacity and a new file is being created for continued sequential logging. The delegate callback can also be called at suspend boundaries, or when the FileLoggingSession is disposed.
When the delegate is invoked, the app receives an StorageFile that represents the now-closed log file. The app can forward the log file for processing in an application-defined way. After this, the session continues logging to a newly created and now-open current log file. When this log file reaches capacity, the callback delegate is invoked again for the new file, and the process repeats.
Minimum supported client
|Windows 8.1 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 R2 [Windows Store apps only]|