Instructional Material: Logging

We are now going to take a look at logging (also called tracing) as a tool to debug our robot programs. Logging is recording useful information from the robot program to a disk file on the RoboRio controller. You can then download that file to your PC and examine it. It can be very useful to record information while your robot is running during a match so you can look at it afterwards and see what took place. If you have not read the general lesson on Logging, you should do that now.

Note that the FRC control system supports using System.out.println to write information to the RioLog and to the session log on the Driver Station. However these two ways to log information have drawbacks. The RioLog does not persist and is not available during match play. The DS log also contains extensive logging from the control system and it can be hard to separate out your logged information. Niether form of logging provides automatic identification of where in your program the logged information comes from. The logging code provided here automatically marks all logged information with the date, time, name of method and location in your source file where the information was logged. Only your logged information is recorded. The information is recorded in a new disk file for each startup of the RoboRio and can be easily downloaded after sessions or matches for review. Note that the logged information is also sent to the RioLog and the DS log.

To use the Logging class below with the Sample robot program, create a new class called Logging in the same folder as Copy and paste the code into that class.

Now you can modify the Sample program as follows to use logging instead of System.out.println():

You can view the log file on the RoboRio disk with a browser. Navigate to ftp://roborio-teamnumber-frc.local/home/lvuser and select the desired log file. You can download the log file with Windows Explorer. Navigate to the url ftp://roborio-teamnumber-frc.local/home/lvuser/ and copy the desired log file to a local directory.

Note: Log files are numbered 0-99. After 99 no new log files will be created and an error will be logged to the DS console window. You must use Windows Explorer to delete old log files.


Material Type: 
Education Level: 
Middle School
High School
Focus Subject: 
Computing / Computer Science
Robotics Software
HW Platform: 
SW Platform: 
Interactivity Style: