FTC Creating Log Files 202008
From wikidb
Contents
Existing Log Files
- FTC workshop debugging
- log on page 72
On Comput Platform
On Drivers Station
maybe this was on the controller hub with a keyboard plugged in
- ... -> File Manager app -> Documents -> driverStationLog.txt
- saw a log on the driver station
- File Manager app
- Documents
- driverStationLog.txt
- Documents
Using
- check date
adb shell date Thu Aug 6 15:50:46 PDT 2020
- is correct (3:50 pm)
- Set the date from a shell on Android
- write to
- FTC Tech Tip Log files
- Tom Eng Trouble Shooting Guide DbgLog removed in 3.3 see section 16.7.2
Create Log Files
- Redit Write to file This references the St. Paul Academy Log.java file.
- St. Paul Academy Log.java HOMAR FTC Library]
TBD: add comments to above
To remove a null pointer exception the follow modifications were made. See the following added around line 9 import java.lang.String; See the following added around line 30 line = new String("");
Date info
TBD: Move this to performance maasurement
- System e.g. nanotime currentTimeMillis
Time Format References
Effective for creating file names
- Simple Date Format Official site. e.g. This is what I added to a file name: "yyyyMMddHHmm"
- Date Format Official site
Example Code
import java.text.SimpleDateFormat; import java.util.Date; public class SimpleDateFormatExample { public static void main(String[] args) { Date date = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); String strDate= formatter.format(date); System.out.println(strDate); } }
Open AppData directory
Windows Live files are usually stored in two locations, the Roaming and Local folders contained within the AppData folder (Users\[your username]\AppData\) To open the AppData folder on Windows 10, 8 & 7: Open File Explorer/Windows Explorer Type %AppData% into the address bar and hit enter Navigate to the required folder (Roaming or Local) To permanently display all hidden folders on Windows 10 & 8: Open File Explorer/Windows Explorer Click View then select Options In the Folder Options window, choose View, select Show hidden files, folders, and drives, and then click OK