However, as soon as I place the jython-standalone .jar file in conf\automation\jython and restart Openhab all logging stops. For example when I log:tail in the console I get nothing.
If I delete the jython-standalone .jar file and restart Openhab again, log:tail produces all the usual output. It also shows all the ServiceEvents REGISTERED of all the .py files etc… But when I save a .py file it of course says ScriptEngine for py not available
Maybe surprisingly Openhab seems to be running ok, even when I get no logs. The various interfaces all work, and sensor data seems to come through. So it would seem that only the logging is broken.
In the userdata\logs folder I do not see the timestamp updated either. The timestamp stays the same as the last time Openhab ran.
I have tried:
restoring the log config file org.ops4j.pax.logging.cfg on my ‘production’ version of Openhab (I saw this on some other threads)
deleting tmp, cache folders at various stages
a completely empty ‘standard’ fresh install using 2.5 M2 version (only with experimental rule engine installed)
setting EXTRA_JAVA_OPTS as env variable, and in the start.bat file:
But when I observed this, the logs were working. I haven’t tested on a Windows install in a couple months, so this could be something new. I’ll boot over to Windows and take a look sometime later today.
Are you missing the set EXTRA_JAVA_OPTS= from the beginning of this line? From the docs…
REM Add to the top of the file
set EXTRA_JAVA_OPTS=-Xbootclasspath/a:C:\openhab2\conf\automation\jython\jython-standalone-2.7.0.jar -Dpython.home=C:\openhab2\conf\automation\jython -Dpython.path=C:\openhab2\conf\automation\lib\python
I finally booted into Windows and was amazed that I could reproduce this. However, by fiddling around and restarting OH a bunch of times, the logs worked again. I’ll look into it some more and open an issue if I can’t figure out the cause/fix.
Any luck with fiddling around with things or trying multiple restarts of OH? I have had no luck. For me I went to OH2.5 so that I wouldn’t have to change setenv.bat, and I’d be in the correct future configuration for the start.bat file. (See this post from @5iver).
@Bruce_Osborne, I’ve considered this, but this is only my test box, I mess around with the new stuff when I’m on the road. My actual home setup is a linux NAS that I built. It works great and once stuff is running smooth on windows I port it over to that box. Not ideal probably, but hadn’t had a problem like this until now.
One more update, just for kicks I went in and actually edited the setenv.bat file, and as I expected it didn’t change the result. I’m pretty sure that I’m actually getting the environment set up correctly, and that there is an underlying error that’s causing the logging break. Just like @gjj81, if I look through my logfiles, there are no updates whatsoever while this error is in effect. Only ERROR level logs print out on the Karaf console in real time, and their formatting is all wrong, but don’t get logged to files.
I’ve got JSR223/Jython working fine on Windows 10, OH 2.4 Stable. It will not work on the Windows machine with any more recent version (2.5 Milestones or Snapshots).
Now that I’m back home I am trying to get it working on my main Linux box, and I am having no luck whatsoever. I have tried the most recent snapshot, 2.5 M1 and M2, and 2.4 Stable, and with each of those versions the logs all disappear when I put the JYTHON EXTRA_JAVA_OPTS line in. I have tried adding it to etc/default/openhab2, start.sh and setenv and all three end up the same.
In addition I’m seeing problems in all 2.5 versions where there’s a conflict between GoogleTTS and the RESTDOCS. swagger.json can’t be found or accessed when clicking on the REST UI page. This is a mess! I was really hoping to get going with python rules.
What version of Java did you use on Windows and now in Linux? And have you been following these installation instructions? Myself and others have done this install many, many times without issues on Linux with OH2.4 through the latest snapshots. I’m not saying it’s impossible that there is an issue, but it is much more likely that there is a problem in your configuration.
Are you doing fresh installs or are you upgrading and downgrading? How are you upgrading and are you clearing the cache? In 2.5M2, the RESTDOCS was moved to the UIs.
@5iver, on my Windows Machine I have Java SE 1.8.0_221-b11. On the Linux machine it’s OpenJDK 11.0.4 (2019-07-16). I’m in agreement with you, especially now that my linux install is also having issues, that there’s something I’m doing wrong, or a config problem on my end.
I followed the installation instructions to the letter, as far as I can tell. On windows I believe I’m doing “fresh” installs… I follow the backup/upgrade instructions in the documentation. On Linux I’m just using the command line instructions and installing the package over the old one. (Keeping a backup in case of emergency). Going from 2.4 to 2.5 seems to need some config changes which I go in and update as needed in between installs (the Logging config file changes a bit, switching from mail action to binding, and moving the restdocs from “misc” to “ui”).
Oh, and yes, I do clear the cache and tmp folders every time I go through this.
Wow, you know I think I vaguely remember reading that years ago when I first loaded openhab, but after numerous “sudo apt update/upgrade” I guess somehow I ended up with 11. I’ll try to figure out how to revert to 8.
This will definitely cause issues. Which Linux distribution are you using?
Are you using the update script? I don’t use a repository installation, but I would think you’d need to upgrade an existing installation rather than installing again over the top of another version. If downgrading the Java does not help, I suggest backing up, uninstalling, and then reinstalling from scratch.
I am using Ubuntu Server 18.04.3 LTS on the Linux box.
No, I am not using the update script, I don’t think I communicated my method very well… I actually use the repository and did a Package Repository Installation to originally install, and then I use the procedure here to upgrade or downgrade and choose the specific build I want, as I’ve done a few times in the last day or two.
However, the main update is that I rolled back from Java 11 to Java 8 using this guide and I’m now in business on JSR233/Jython! It wasn’t exactly seamless when I fired up OpenHAB after switching to Java 8, it took about 3 restarts of OH, and streams and streams of red error logs, but eventually it settled out. And, the RestDocs UI now works as well. There are some things that have stopped working that I need to figure out (seems like executeCommandLine and sendHttpGetRequest might be broken) but I will have to troubleshoot tomorrow.
Correction to my post above, the RestDocs UI is still broken when GoogleTTS is installed (can’t find swagger.json). And, sound commands like “playSound()” and “say()” are not working, from rules DSL or from Karaf.
However, pretty much everything else seems to be working, false alarm on “executeCommandLine()” and “sendHttpGetRequest()”.