Logging
Introduction Logging means keeping an ordered record of events, function calls, variable values at a certain time during runtime, etc. This is usually saved in the form of text in a log file. It is...
Introduction
Logging means keeping an ordered record of events, function calls, variable values at a certain time during runtime, etc. This is usually saved in the form of text in a log file. It is an invaluable tool for a software developer, especially when debugging, as it can provide detailed information on what the code is doing at any given moment. Good use cases include ensuring certain blocks of code are being executed, inspecting data values passed between functions, and reporting potential issues.
Accessing Logs
There are a few different ways to access the logs when working with UE4:
- If your Play-In-Editor session has ended, you can find the full log of that session in YourProjectName\Saved\Logs folder. The logs from previous sessions will be there as well, in case you ever need to access them. If you do not know where your project is located, you can open your project library in the Epic Games launcher, right-click on the project in question, and then select Show in Folder option.
- You can see the log output in real time while playing in Editor in the Output Log tab. If it is not open by default, you can find it under Window->Developer Tools->Output Log. In addition to real-time logging, this tab will keep all log information from all play sessions that happened during the current Unreal Editor session.
- If you have an executable, you can create a shortcut with
at the end of its name to open the log as you launch the executable.-Log
- You can open the console when your game is running by pressing the tilde (~) key and access the log by typing in the console command
and pressing the Enter key. Note that if you do this during a Play-In-Editor session, clicking x to close the log will close your Unreal Editor session.showlog
Log Verbosity Levels
In certain cases, it is useful to see a less or more detailed log output. Log verbosity levels allow for easy control of the level of detail present in a given log. If a particular log statement is more verbose than the compile-time verbosity, it will not be compiled into the game code. Afterwards, the level of the whole log is set to default verbosity, which can be changed in the Engine.ini file. Runtime verbosity can be changed through the command line. Given a certain verbosity level of the log, only log messages with matching or lower verbosity level will be printed to it. Messages with a higher verbosity level will be ignored.
The following table lists all available verbosity levels, from lowest verbosity to highest:
Verbosity Level | Printed in Console? | Printed in Editor's Log? | Notes
--------------- | ------------------- | ------------------------ | -----------------------------------------------
Fatal | yes | -- | crashes the session even if logging is disabled
Error | yes | yes | log statement text is red
Warning | yes | yes | log statement text is yellow
Display | yes | yes | log statement text is light gray
Log | no | yes | log statement text is light gray
Verbose | no | no | --
VeryVerbose | no | no | --
Each log statement declares which log category it belongs to as well as its verbosity level.
Logging Syntax
...To be written...
Formatting Examples Quick Reference
...To be written...
Custom Log Categories
...To be written...