Lesson: Logging

Overview: 
Explore logging or tracing of data by a Java program on a robot for later examination. This is a common technique to debug programs.
Objectives: 

Understand logging basic concepts.

 

Content: 

Logging, also called tracing, is the practice of recording debugging information from your program in a disk file for later examination. When logging, you place method calls in your program to call either the Java Logging system or helper methods in code provided by this course. As said in the last lesson, file output is a topic beyond the scope of this curriculum and the details of using the Java Logging system directly are as well. But, due the usefulness of logging in debugging robot programs, we are providing you with code to do logging for you. In each of the three sections on the FIRST robotic platforms, there will be a lesson on how to implement logging in your programs.

It is really pretty simple. You add a .java file containing the logging code to your project and then in your own code, you can call one of the logging methods provided by the logging code to record whatever information you think is useful to a file on the robot controller. You then use the appropriate utility program to pull that file back to your development PC where you can examine it. Each record in the log file contains the time of day, the class in your code where you called the log method and the source file and line number where that call is located. This makes it easy to go from the log file back to your code.

 

Navigation: