Kernel Journaling
Let's keep the journals here.
Let's keep the journals here.
Kernel journals are JSON files that tell you how the kernel is going, such as the boot process and raised events. They are serialized to the journal entry class, JournalEntry
, which you can get all of the current session's kernel journals by using a function, GetJournalEntries()
. Each entry contains the following items:
Date
: the date in which the event happened.
Time
: the time in which the event happened.
Status
: The status of the journal that can be expressed by the JournalStatus instances.
Message
: The contents of the journal.
Each kernel session contains a JSON file that has the following format:
This JSON file is serialized as an array of JournalEntry
instances and is automatically saved when a write occurs.
Writing to the kernel journal is straightforward, as there are two functions that are simple to use:
You can write any message, like a progress of some operation, to the kernel journal using just the message as an argument. However, this message will get saved as an informational message to the kernel journal. This means that the message that you write to the kernel journal using the first function will have the journal status of Info
.
To specify the journal status, you'll have to select one of the JournalStatus
values after writing your message. This feature is available in the second function overload.
The journal status can be one of:
Fatal
: A fatal error has occurred
Error
: An error has occurred
Warning
: A continuable error has occurred
Info
: Just a simple message
You can also manipulate with the kernel journals using the following available functions:
You can get all the current session's kernel journal entries by calling the GetJournalEntries()
function to get these entries with the properties that are explained at the top of this page.
To manually save the kernel journals for this session, you can use the SaveJournals()
function to force saving all the journals to the current session's journal file.
The journal management class also provides you an easy way to print the journal log and its details, such as the time, the status, and the message. You can use the GetJournalEntries()
function to print the log to the console.