Logging Overview

Written by Anthony Pavia on Sep 13, 2022 10:39 am

Applications can log information they are generating into a .log file to view. This feature can be crucial to some users, letting them be able to monitor data that constantly needs supervision. Log files can roll over as well, which happens when a log file runs out of space. When this occurs, a new empty file with the same name is created to log more data, while the old file that has no more space gets a .bat extension added to the end of the file name. This allows for data to be retained longer before being overwritten. 

To use logging in a software application on the JNIOR, you will need to use the JANOS class of the JANOS runtime library. With it you can define a log file name and what you want to log to it. If the log file exists at the location you specify, it will add what enter to it. If the log file doesn’t exist, it will create the log file, and then log what you enter to it. Below is a short example of creating/adding to a log file that exists in the temp folder of the JNIOR.

View on GitHub

I put the built jar file of this example application into the JNIOR’s flash folder and ran it from the Web UI’s console tab. As you can see after running it, going to the temp directory of the JNIOR shows the loggingExample.log file.

On this page
Tags