To troubleshoot problems when working on the FRPG server, it can be useful to access the logs. An example of when you might need this is when trying to login to the FRPG companion app, and you're getting a 500 error.
You will need to first open an SSH tunnel into the FRPG server. Please ask Dr. Wellington for credentials if you need them. Follow [this guide](ssh_in) to get into the server via SSH.
There are two ways to access logs in the server:
- with the `frpg` command (doesn't appear to work at the moment):
-`frpg compose logs -f frpg_restful_server`
- with the `tail` command (preferred method)
-`tail -f logs/restfulserver/yyyy-mm-dd.log`
<br>
# Using the `frpg` command
The above example uses the restful server as a reference. You can replace the server names as needed. If the server you need to investigate the logs of is not the restful server, you'll need to get the name of its container in Docker:
-`frpg compose ps`
Then, find the name of the container within the list the command gives you, and replace `frpg_restful_server` with that name.
For instance, if you're trying to view the logs of the login server, the container name would be `frpg_login_server`. The command would look like:
-`frpg compose logs -f frpg_login_server`
<br>
# Using the `tail` command
This command accesses files within local directories. So, once you are logged into the server via SSH, navigate into the following folder:
-`FreshmanRPGSuite/FreshmanRPG`
You can do this by running the following commands:
-`cd FreshmanRPGSuite`
-`cd FreshmanRPG`
Then, to list all of the folders within the `logs` directory, run this command:
-`ls logs`
So, if you are debugging the restful server, then all of the logs will be inside of the `restfulserver` folder. If you are debugging something else, like the sorting room server, you might not see its folder name. In this case, it might be located within the `gameserver` folder, as there are different types of game servers.
If that is the case, you can see your options by listing the files within that folder:
-`ls logs/gameserver`
More than likely, you'll see names like `cub.tmx` and `sortingRoom.tmx`. These are all folders, and all of the files within them are log files, just like all of the files within the `restfulserver` folder.
Now, list all of the log files within the folder that matches the server that you need to debug.
If the restful server,
-`ls logs/restfulserver`
If the sorting room server,
-`ls logs/gameserver/sortingRoom.tmx/`
etc.
> Tip: These commands can get tedious, but you can make it much easier by pressing tab as you type the name of a folder. This will autocomplete that folder's name for you.
Now you should see a list of files that follow a specific format: `Year-Month-Day.log`, or more specifically, `YYYY-MM-DD.log`. Find the log file that is the most recent. It will most likely be the day that the server was last started. For instance, if the server was started today, you'll see a file name that matches today's date.
This is the file that will contain the most recent log information, and will also be updated in real time. So, once you find out what the file is, run the `tail` command on it, replacing `yyyy-mm-dd` and `restfulserver` as appropriate for your case:
-`tail -f logs/restfulserver/yyyy-mm-dd.log`
If the output doesn't show enough data, `ctrl+c` to exit, then run it with the `-n` flag with the number of lines you need to view. For 100 lines, do:
Now the logs should be updating in real time. You can now try to reproduce the error you got before, to see if a stacktrace pops up and/or to get additional information.