Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blocks:drivers:troubleshooting [2018-01-13 18:31]
admin
blocks:drivers:troubleshooting [2019-06-05 14:52] (current)
admin updated root dir name
Line 10: Line 10:
 If a driver doesn't work at all, check the log file of the computer running Blocks. This file is located here, under the home directory of the user under which Blocks is running: If a driver doesn't work at all, check the log file of the computer running Blocks. This file is located here, under the home directory of the user under which Blocks is running:
  
- PIXILAN-root/logs/latest.log+ PIXILAB-Blocks-root/logs/latest.log
  
 Open a terminal window ("Terminal" on MacOS or Linux and "Powershell" on Windows). Use the //cd// command to move into the "logs" directory mentioned above. Then type the following command on MacOS: Open a terminal window ("Terminal" on MacOS or Linux and "Powershell" on Windows). Use the //cd// command to move into the "logs" directory mentioned above. Then type the following command on MacOS:
Line 40: Line 40:
  */  */
 interface console { interface console {
-  log(...toLog: string[]):void; // Synonymous with info +  log(...toLog: string[]):void;    // Synonymous with info 
-  info(...toLog: string[]):void; // Log as info message +  info(...toLog: string[]):void;    // Log as info message 
-  error(...toLog: string[]):void; // Log as error message +  error(...toLog: string[]):void;    // Log as error message 
-  warn(...toLog: string[]):void; // Log as warning message+  warn(...toLog: string[]):void;    // Log as warning message
 } }
 </code> </code>
  
 :!: You may want to remove, or comment out, any logging calls in your driver once you get it working. This avoids unwanted noise in the log file, and may slightly improve the performance of your driver. :!: You may want to remove, or comment out, any logging calls in your driver once you get it working. This avoids unwanted noise in the log file, and may slightly improve the performance of your driver.
- 
 ==== Increasing the Log Level ==== ==== Increasing the Log Level ====
  
-Most troubleshooting methods involve viewing Blocks log file. By default, this log file contains only errors encountered while running Blocks. In some cases, you may want to increase the verbosity of the logging. This can be done by adding the following lines to a file named //config.yml//, located in the //PIXILAN-root// directory in the home directory of the current user:+Most troubleshooting methods involve viewing Blocks log file. By default, this log file contains only errors encountered while running Blocks. In some cases, you may want to increase the verbosity of the logging. This can be done by adding the following lines to a file named //config.yml//, located in the //PIXILAB-Blocks-root// directory in the home directory of the current user:
  
 <code> <code>
 # Logging verbosity level. Specify one of ERROR, WARN, INFO # Logging verbosity level. Specify one of ERROR, WARN, INFO
 logging: logging:
-  level: INFO+  loggers: 
 +    Script: INFO  # Verbose logging for scripts/drivers
 </code> </code>
  
-If the file doesn't exist, create it using a plain text editor. The default value for the verbosity is ERROR, which lists only errors. For more details, change this to //WARN// to also include warnings, or to //INFO// for miscellaneous information. Restart the Blocks server after making any changes to this file.+If the file doesn't exist, create it using a plain text editor. Copy and paste the code above into the file The default value for the verbosity is ERROR, which logs only errors. For more details, change this to //WARN// to also include warnings, or to //INFO// for miscellaneous information, including logging you do using any //console.log// statements in your driver. Restart the Blocks server after making any changes to the config.yml file. 
 + 
 +:!: Setting the logging level to INFO may write lots of details to the log file. While you may want it set to INFO while developing drivers, or to troubleshoot other issues, you should set it back to WARN or ERROR for normal use of Blocks. 
 +===== Viewing the Log Remotely ===== 
 + 
 +While a separate development computer is preferable for driver development, you may sometimes run into issues with a production server, requiring you to access its log file. If so, you can either access the server locally, viewing the log file as described above. Or you can access the log file remotely, as described [[blocks:server:advanced_server_configuration#viewing_logs|here]]. 
 + 
 +==== Archived Log Files ====
  
-:!: Setting the logging level to INFO will write lots of internal details to the log file. While you may want it set to INFO while developing driversor to troubleshoot other issuesyou should set it back to WARN or ERROR for normal use of Blocks.+If you want to investigate an error that occurred some time ago, the information may no longer be in the //latest.log// file. If so, Blocks keep an archive of recent log files next to the //latest.log// file. Those files are compressed. Transfer the log file to a separate computerunpack itand view it there using a plain text editor.
  
-===== Enable Hot-swapping of Drivers =====+===== Reloading Changes Automatically =====
  
-When you add drivers, or make changes to a driver, you must normally restart Blocks for those changes to take effect. As this can make the development more time consuming, and alternative is to enable automatic reloading of scripts. This is also done in the //config.yml// file mentioned above, by adding the following lines:+When you change drivers, you must normally restart Blocks for those changes to take effect. As this can make the development more time consuming, an alternative is to enable automatic reloading of scripts. This is also done in the //config.yml// file mentioned above, by adding the following lines:
  
 <code> <code>
Line 72: Line 79:
 </code> </code>
  
-Remember to restart Blocks when you make any changes to the //config.yml// file.+Remember to restart Blocks after changing the //config.yml// file to make it take effect.