Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Script does not Print to System Console on Linux laptop
#scripting
Howdy all.? I am working on an older HP laptop running Lubuntu Linux with JMRI 5.11.6 and Java 17.0.12.? I am writing scripts for use with my MQTT project, but I realized that I cannot print anything to the System Console in my script.?? I do get about 40 lines of messages when an error occurs, but my print statements do not show any results in most scripts.? Even when I start PanelPro from the Terminal, I do not see any results from print statements.? An exception to that is the Set-Every-Sensor-ToInactive.py script which prints
?
I was sure that I have seen items printed out on my other computers, so I figure I must have a setting or configuration set wrong on this computer.? I often used print statements to see what the script is working with (print out a variable for example).
?
Hopefully there is something I can change to make it print.? Thanks in advance for any thoughts, ideas and help.
?
Phil from gorgeous Young Harris, Georgia, USA
?
Here is the System Console when starting:
22:04:19,662 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- * JMRI log ** [main] 22:04:19,738 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- This log is stored in file: /home/phil/.jmri/log/session.log [main] 22:04:19,741 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- This log is appended to file: /home/phil/.jmri/log/messages.log [main] 22:04:19,799 apps.Apps ? ? ? ? ? ? ? ? ? ? ? ? ? ? INFO ?- PanelPro version 5.11.6+R1b48891fa4 starts under Java 17.0.12 on Linux amd64 v6.8.0-59-generic at Thu May 15 22:04:19 EDT 2025 [main] 22:04:20,044 t.permission.DefaultPermissionManager INFO ?- Permission file: /home/phil/.jmri/.permissions.xml [main] 22:04:20,069 t.permission.DefaultPermissionManager INFO ?- Permission system is enabled: no [main] 22:04:22,850 apps.Apps ? ? ? ? ? ? ? ? ? ? ? ? ? ? INFO ?- Starting with profile MQTT.3e352f94 [main] 22:04:22,938 jmri.util.node.NodeIdentity ? ? ? ? ? INFO ?- Using f7cdb150-c041-4957-b46a-5fd914db4bf8 as the JMRI storage identity for profile id 3e352f94 [AWT-EventQueue-0] 22:04:23,258 jmri.jmrix.mqtt.MqttAdapter ? ? ? ? ? INFO ?- MQTT starting connect with MQTTchannel = "" [main] 22:04:23,270 jmri.jmrix.mqtt.MqttAdapter ? ? ? ? ? INFO ?- Connection M is using a clientID of "MyJMRIRailJMRI2420C21CM" [main] 22:04:23,848 jmri.jmrix.mqtt.MqttPowerManager ? ? ?INFO ?- Subscribed to track/power [main] 22:04:24,525 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path program: is /home/phil/Downloads/JMRI/ [main] 22:04:24,526 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path preference: is /home/phil/Railroad/MQTT/ [main] 22:04:24,526 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path profile: is /home/phil/.jmri/MQTT.jmri/ [main] 22:04:24,527 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path settings: is /home/phil/.jmri/ [main] 22:04:24,528 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path home: is /home/phil/ [main] 22:04:24,528 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path scripts: is /home/phil/Railroad/Jython/ [main] 22:04:25,684 apps.PanelPro.PanelPro ? ? ? ? ? ? ? ?INFO ?- Main initialization done [main] 22:04:55,679 jmri.jmrit.jython.RunJythonScript ? ? INFO ?- No file selected [AWT-EventQueue-0] |
Phil, If Script Output is NOT open, print output goes to the system console.? Dave Sand? ----- Original message ----- From: "Phil in gorgeous Young Harris via groups.io" <philabernathy=[email protected]> Subject: [jmriusers] Script does not Print to System Console on Linux laptop Date: Thursday, May 15, 2025 9:07 PM Howdy all.? I am working on an older HP laptop running Lubuntu Linux with JMRI 5.11.6 and Java 17.0.12.? I am writing scripts for use with my MQTT project, but I realized that I cannot print anything to the System Console in my script.?? I do get about 40 lines of messages when an error occurs, but my print statements do not show any results in most scripts.? Even when I start PanelPro from the Terminal, I do not see any results from print statements.? An exception to that is the Set-Every-Sensor-ToInactive.py script which prints ? I was sure that I have seen items printed out on my other computers, so I figure I must have a setting or configuration set wrong on this computer.? I often used print statements to see what the script is working with (print out a variable for example). ? Hopefully there is something I can change to make it print.? Thanks in advance for any thoughts, ideas and help. ? Phil from gorgeous Young Harris, Georgia, USA ? Here is the System Console when starting: 22:04:19,662 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- * JMRI log ** [main] 22:04:19,738 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- This log is stored in file: /home/phil/.jmri/log/session.log [main] 22:04:19,741 apps.util.Log4JUtil ? ? ? ? ? ? ? ? ? INFO ?- This log is appended to file: /home/phil/.jmri/log/messages.log [main] 22:04:19,799 apps.Apps ? ? ? ? ? ? ? ? ? ? ? ? ? ? INFO ?- PanelPro version 5.11.6+R1b48891fa4 starts under Java 17.0.12 on Linux amd64 v6.8.0-59-generic at Thu May 15 22:04:19 EDT 2025 [main] 22:04:20,044 t.permission.DefaultPermissionManager INFO ?- Permission file: /home/phil/.jmri/.permissions.xml [main] 22:04:20,069 t.permission.DefaultPermissionManager INFO ?- Permission system is enabled: no [main] 22:04:22,850 apps.Apps ? ? ? ? ? ? ? ? ? ? ? ? ? ? INFO ?- Starting with profile MQTT.3e352f94 [main] 22:04:22,938 jmri.util.node.NodeIdentity ? ? ? ? ? INFO ?- Using f7cdb150-c041-4957-b46a-5fd914db4bf8 as the JMRI storage identity for profile id 3e352f94 [AWT-EventQueue-0] 22:04:23,258 jmri.jmrix.mqtt.MqttAdapter ? ? ? ? ? INFO ?- MQTT starting connect with MQTTchannel = "" [main] 22:04:23,270 jmri.jmrix.mqtt.MqttAdapter ? ? ? ? ? INFO ?- Connection M is using a clientID of "MyJMRIRailJMRI2420C21CM" [main] 22:04:23,848 jmri.jmrix.mqtt.MqttPowerManager ? ? ?INFO ?- Subscribed to track/power [main] 22:04:24,525 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path program: is /home/phil/Downloads/JMRI/ [main] 22:04:24,526 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path preference: is /home/phil/Railroad/MQTT/ [main] 22:04:24,526 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path profile: is /home/phil/.jmri/MQTT.jmri/ [main] 22:04:24,527 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path settings: is /home/phil/.jmri/ [main] 22:04:24,528 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path home: is /home/phil/ [main] 22:04:24,528 jmri.util.FileUtilSupport ? ? ? ? ? ? INFO ?- File path scripts: is /home/phil/Railroad/Jython/ [main] 22:04:25,684 apps.PanelPro.PanelPro ? ? ? ? ? ? ? ?INFO ?- Main initialization done [main] 22:04:55,679 jmri.jmrit.jython.RunJythonScript ? ? INFO ?- No file selected [AWT-EventQueue-0] |
Phil,
?
If it is important that a script force a message be printed on the System Console, the use of the logging library provides a number of useful features.??
?
A simple example in the distributed jython\test folder is named "LoggingTest.py" and several other distributed example scripts make more sophisticated use of the "org.slf4j" library.??
?
The website gives a lot more info.? Maybe more than you wanted to see, since the target audience is the JMRI Java developers.? Most of it is also useful for script developers.??
?
Cliff in Baja SoCal |
On Thu, May 15, 2025 at 10:47 PM, Dave Sand wrote:
Thanks Dave and Cliff for responding.?? ?
However, how do I close Script Output??? I looked at the link and at default_lcf.xml, but it appears to be above my pay grade, with no explicit verbiage to turn on or off logging to the console.?
?
Phil
LoggingTest.py output is here, then I loaded my panel and it ran a script to change sensors to Inactive:
?
15:33:20,563 LoggingTest.py ? ? ? ? ? ? ? ? ? ? ? ?WARN ?- This WARN is OK, it's emitted from LoggingTest.py on purpose [AWT-EventQueue-0] 15:33:59,634 jmri.configurexml.LoadXmlConfigAction INFO ?- Loading selected file: /home/phil/Railroad/MQTT/MQTT-ESP32Config-2025-05-16-0849.xml [AWT-EventQueue-0] 28 total sensors found, all 28 changed to INACTIVE |
Phil, If you want script "print output" to go to the system console, do not open the "Script Output" window. ?Don't use the "Scripting -> Script Output" menu ?or a "Preferences -> Start Up" action. The default for Jython print statements is to write them to the system console. ?If the Script Output window has been opened, then the print statements are redirected to the Script Output window. You don't need to do anything else. Dave Sand ----- Original message ----- From: "Phil in gorgeous Young Harris via groups.io" <philabernathy=[email protected]> Subject: Re: [jmriusers] Script does not Print to System Console on Linux laptop Date: Friday, May 16, 2025 2:43 PM On Thu, May 15, 2025 at 10:47 PM, Dave Sand wrote:
Thanks Dave and Cliff for responding.?? ? However, how do I close Script Output??? I looked at the link and at default_lcf.xml, but it appears to be above my pay grade, with no explicit verbiage to turn on or off logging to the console.? ? Phil LoggingTest.py output is here, then I loaded my panel and it ran a script to change sensors to Inactive: ? 15:33:20,563 LoggingTest.py ? ? ? ? ? ? ? ? ? ? ? ?WARN ?- This WARN is OK, it's emitted from LoggingTest.py on purpose [AWT-EventQueue-0] 15:33:59,634 jmri.configurexml.LoadXmlConfigAction INFO ?- Loading selected file: /home/phil/Railroad/MQTT/MQTT-ESP32Config-2025-05-16-0849.xml [AWT-EventQueue-0] 28 total sensors found, all 28 changed to INACTIVE |
Thanks again Dave for continuing help.? I have never used the Scripting/Scripting Output option, but now that I've found it and opened it, I see all my print results.? I guess I can use that rather than, or in addition to, the System Console.??
?
I don't not know what is different now but this will allow me to bumble my way through scripts by giving me the information I print during development.
?
Phil |
to navigate to use esc to dismiss