IOLOG Command
We are all familiar with logs. These are text files someplace that list events such as logins, configuration changes, errors, etc. On the JNIOR the jniorsys.log
file is one such log. These things are useful for systems and web servers. The JNIOR is also a controller and it can be very useful to have a log of I/O activity either digital or serial. This is provided by the IOLOG command.
bruce_dev /> help iolog IOLOG Options: -T Indicate transitions -R Reset logs -A AUX Serial log -S Sensor Port log -O Output to stdout Generates jniorio.log file from available logs. bruce_dev />
The above HELP alludes to some different logging capabilities. There is something with transitions. That is a detailed log of recent Digital Input and Relay Output transitions. That even includes relays contained in the external expansion modules. The AUX port supports a bidirectional Transmission Log that details communications traffic that includes both the bytes and the timing. There is also a log for the Sensor Port.
The Series 4 JNIOR by default logs all all of this activity to internal buffers. At any time you can dump the log buffers into a file or to the display using the IOLOG command. The IOLOG -R command can be used to reset a log. This can be useful in debugging where you don’t want to be distracted by prior data. I will show some examples.
Let’s start with the AUX Serial Port since it is fresh in my mind. Here the IOLOG -AR command will remove historical data from the AUX port transmission log. The does not affect the other logs. The IOLOG -AO comand will display the log content. For example…
bruce_dev /> iolog -ao -- 11/21/17 12:13:04.991 FE 56 01 FE 56 02 FE 56 03 FE 56 04 FE 56 05 FE ~V.~V.~V.~V.~V.~ 56 06 FE 58 FE 52 FE 9D 13 FE 9C 40 FE 42 01 FE V.~X~R~..~.@~B.~ 47 01 01 34 31 30 20 53 4E 20 36 31 34 30 37 30 G..410 SN 614070 35 30 30 20 20 20 20 4A 41 4E 4F 53 20 76 31 2E 500 JANOS v1. 36 2E 33 2D 72 63 33 20 20 20 20 62 72 75 63 65 6.3-rc3 bruce 5F 64 65 76 20 20 20 20 20 20 20 20 20 20 20 31 _dev 1 30 2E 30 2E 30 2E 35 39 20 20 20 20 20 20 20 20 0.0.0.59 20 20 20 FE 42 01 ~B. -- 11/21/17 12:13:14.872 +9.741 -43- FE 47 01 01 7E 44 69 67 69 74 61 6C 20 49 6E C~G..~Digital In 70 75 74 73 20 20 20 20 20 20 52 65 6C 61 79 20 puts Relay 4F 75 74 70 75 74 73 20 20 20 20 20 20 20 43 6C Outputs Cl 6F 63 6B 20 20 20 FE 47 01 04 20 53 70 6C 61 73 ock ~G.. Splas 68 20 53 63 72 65 65 6E FE 42 01 h Screen~B. -- 11/21/17 12:13:24.860 +9.873 -48- FE 47 01 01 20 FE 47 01 02 7E FE 42 01 -48- FE H~G.. ~G..~~B.H~ 47 01 02 20 FE 47 01 03 7E FE 42 01 G.. ~G..~~B. -- 11/21/17 12:13:31.967 +6.306 -45- FE 47 02 01 20 20 20 20 20 20 20 20 20 20 20 E~G.. 20 20 20 FE 47 01 02 54 75 65 20 4E 6F 76 20 32 ~G..Tue Nov 2 31 20 31 32 3A 31 33 3A 33 32 20 45 53 54 20 32 1 12:13:32 EST 2 30 31 37 FE 47 02 04 20 20 20 20 20 20 20 20 20 017~G.. 20 20 20 20 FE 42 01 FE 47 13 02 33 FE 42 01 FE ~B.~G..3~B.~ 47 13 02 34 FE 42 01 FE 47 13 02 35 FE 42 01 FE G..4~B.~G..5~B.~ 47 13 02 36 FE 42 01 FE 47 13 02 37 FE 42 01 FE G..6~B.~G..7~B.~ 47 13 02 38 FE 42 01 FE 47 13 02 39 FE 42 01 FE G..8~B.~G..9~B.~ 47 12 02 34 30 FE 42 01 FE 47 13 02 31 FE 42 01 G..40~B.~G..1~B. FE 47 13 02 32 FE 42 01 FE 47 13 02 33 FE 42 01 ~G..2~B.~G..3~B. FE 47 13 02 34 FE 42 01 -44- FE 47 02 01 44 69 67 ~G..4~B.D~G..Dig 69 74 61 6C 20 49 6E 70 75 74 73 FE 47 01 02 20 ital Inputs~G.. 52 65 6C 61 79 20 4F 75 74 70 75 74 73 20 20 20 Relay Outputs 20 20 20 7E 43 6C 6F 63 6B 20 20 FE 47 02 04 53 ~Clock ~G..S 70 6C 61 73 68 20 53 63 72 65 65 6E FE 42 01 plash Screen~B. bruce_dev /> iolog -ar AUX logs reset bruce_dev /> iolog -ao bruce_dev />
Here we see data in a traditional dump format with 16 bytes displayed in hexadecimal on the left and an ASCII representation of each byte on the right. If the byte does not represent a printable ASCII character it is replaced with a period ‘.’ in the text display.
The AUX serial communications can be bidirectional. Bytes received by the JNIOR are shown enclosed by a dash ‘-‘. In the example above there are single characters received (keypress codes). When a longer message is received the dashes make the incoming data appear to be desplayed over a background line. It is just a way to distinguish direction.
If the channel remains quiet for a couple of seconds, the IOLOG output includes a timestamp and includes the duration of the pause. All of this can be very helpful in debugging a serial communications based application.
The data displayed here is actual results from an HMI test. The content is explained in detail in a different thread. Here is the link to that discussion viewtopic.php?f=5&t=158&start=20#p316. The interface program generating these communications was developed in the thread.
The AUX Transmission log can be sent to a file using the IOLOG -A command.
bruce_dev /> iolog -a auxio.log generated. bruce_dev />
The file will then contain the data in the same format displayed in the prior post.
The Digital I/O log has quite a different appearance. This is generated using the IOLOG -O command. The digital log is the default log assumed by the command.
bruce_dev /> iolog -o 11/15/17 08:40:27.085, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 09:45:27.073, DIN ---- 0000 0000, RLY ---- ---- 0000 0001 11/21/17 09:45:27.848, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 09:45:29.549, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 09:45:30.330, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 09:45:31.582, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 09:45:32.619, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:05:55.007, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:05:56.056, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:05:58.144, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 10:05:59.943, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:06:05.996, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 10:06:09.173, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:06:11.282, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:06:12.518, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:10:58.434, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:22:00.468, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:25:21.980, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:28:43.913, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:44:08.223, DIN ---- 0000 0000, RLY ---- ---- 0000 0001 11/21/17 10:44:09.621, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:44:10.585, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:45:39.208, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:48:23.797, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 10:48:24.859, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:51:09.241, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:52:02.613, DIN ---- 0000 0000, RLY ---- ---- 0000 0011 11/21/17 10:52:04.316, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:52:05.107, DIN ---- 0000 0000, RLY ---- ---- 0000 0011 11/21/17 10:52:05.891, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:52:08.636, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 10:52:09.168, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:54:14.726, DIN ---- 0000 0000, RLY ---- ---- 0000 0011 11/21/17 10:54:25.912, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 10:55:35.680, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 11:00:48.609, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 11:00:52.456, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 11:05:50.782, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 11:07:27.885, DIN ---- 0000 0000, RLY ---- ---- 0000 0110 11/21/17 11:09:21.747, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 11:09:22.243, DIN ---- 0000 0000, RLY ---- ---- 0000 0110 11/21/17 11:40:23.259, DIN ---- 0000 0000, RLY ---- ---- 0000 0100 11/21/17 11:40:24.670, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 11:59:31.745, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 11:59:33.136, DIN ---- 0000 0000, RLY ---- ---- 0000 0110 11/21/17 12:00:18.043, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 12:05:08.749, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 11/21/17 12:05:10.141, DIN ---- 0000 0000, RLY ---- ---- 0000 0010 11/21/17 12:42:49.123, DIN ---- 0000 0000, RLY ---- ---- 0000 0000 bruce_dev />
This log is generated by combining separate input and output logs. Each can contain up to 500 transitions. Depending on how frequently inputs and relays change you could have data spanning weeks or simply minutes.
Each line represents at least one transition. There is a timestamp to the millisecond. A ‘1’ indicates when an input (DIN) is activated or a Relay (RLY) closed. The inputs and relays are shown from right to left. So the last transition in the above log shows Relay Output 2 opening. There can be up to 16 relays and 12 inputs logged.
The IOLOG -R command will reset the digital log and not affect others. The IOLOG command without options will store the digital log in a file.
bruce_dev /> iolog jniorio.log generated. bruce_dev />
There is also a log for the Sensor Port but unless you are intimately familiar with Dallas 1-Wire communications none of it will make sense. You can write an application to take control over the Sensor Port and communicate with a custom device or non-standard device. It you are working at that level then this log could be very helpful. The Sensor Port log follows the same format as the AUX Transmission Log.