Howto:Showing the FlightGear console on Windows

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.
This has been nominated for deletion. To discuss it, please visit the talk page.

Do not remove this tag until the discussion is closed.

In FlightGear 2016.3, the console and --console option were removed. However, some users may still want the console to debug errors, etc. This article will show how to show the FlightGear console on Windows.

Running flightgear from an already open command window has one small advantage - when flightgear exits (or crashes) the command window, complete with the log messages, stays open. Running from a batch file (unless one puts a "press any button to continue" trap at the end of the batch file) closes the window, and you don´t know what lead to the crash.[1]

Note  This article needs a few screenshots

To show the console it is now necessary to start from the command line.

The full method that I use is as follows. I will detail all of the steps to help those who are not familiar with Windows and the command line. If you already have fgfs as a desktop icon, steps 2 and 3 speed things up a lot.

  1. Make a shortcut to FGFS on the desktop. To do this open the folder that contains fgfs.exe and right-click drag fgfs to the desktop. This creates a shortcut icon.
  2. Right-click the FGFS desktop icon and select "open file location". This is a simple way to open the folder that contails fgfs.exe.
  3. Left click the File tab on the window showing the fgfs directory. Wih the left mouse button held down select "Open command prompt".
  4. A black windows command box will open (still known by many as the DOS command window). The directory will be the one containg fgfs.exe. Typing the Dir command will show other programs, such as fgrun, that are contained in this directory.
  5. Type the command fgfs, followed by any of the normal fgfs arguments, such as --aircraft, --airport., and flightgear will run.
  6. For ease of use set up a .fgfsrc file as described in the main documentation. However be aware that .fgfsrs options conflict badly with the new launcher, and the .fgfsrc file needs to be disabled (I move it to another directory) when you use the launcher.
  7. You can also start flightgear using the command fgrun in this "DOS" box, or you can start with the newlauncher with the comand fgfs --launcher .

All of the flightgear and fgrun log messages will now apear in the "DOS" window.

The reason for changing to this system and getting rid of the old --console option, was to make the error reporting (STDERR) work properly. [2]

The reason is that a console window opened by an application (e.g. running fgfs --console) is not the same as a native windows command window from which an application (e.g. fgfs) is started typing a command at the prompt. It was discovered that error reports were not being sent to a console window that was opened with the --console option. Also it was not possible to pipe output to a file from the window that was opened by the fgfs --console method. For historical reasons the fgfs log file is not (as many folk believe) the same as the log printed in the console window.[3]

It has been suggested that this or section be merged into Fgfs.log.

the enhanced log support would be a step towards killing off the DOS-box for release builds in Windows, since it looks rather retro - and on the basis that we frequently want the log file after-the-fact, the file on disk seemed more useful[4]

The logging to a file always logs at level=info, since anything less is not much use for retrospective debugging[5] Note that also since 2.12, we log at level info to a file in FG_HOME (with two element rotation, so the log from the previous session is also available).[6] The log file only records up to level info, to avoid it growing huge.[7]

Alternative, simpler method, thanks to wllbragg [8]

Make a windows batch file with code similar to:

Note  You may have to fix up paths to match your local installation
rem use just one of these 3 command line examples


rem or this , depending upon where fg is installed, and what options you want. 

"C:\Program Files\FlightGear 2016.3.0\bin\fgfs.exe" --launcher 

rem or this if you want to use fgrun 


rem this line pauses the batch file when fg quits (or crashes) so you can see the console output.


Save it in a file on the desktop for easy access. The file should be saved as type .bat or .cmd. e.g. runflightgear.bat

A third and even simpler method

Modify the desktop shortcut and insert "cmd /K " at start of target.