I run openHAB as a service on a Windows machine (and yes, I know…)
I have reported once before regarding an extra log folder which gets created, but was not able to find the cause. I have now had a chance to do some debugging, but still can’t find the cause.
I followed the following to perform a fresh install:
The initial start using the start.bat file works as expected, with no extra folder/directory created:
However, aftre following the steps to create a Windows Service, and when using the created service to start openHAB, an extra folder get s created called C:\openHAB\userdata\log, should be C:\openHAB\userdata\logs.
I’m also using OpenHab as a Windows service (and Yes, I know too ) and I also get the extra /log folder exactly how you describe with the empty openhab.log file.
The folder is only created when starting the service and not when using start.bat
I thought It was just me but couldn’t find a cause either.
While I don’t have an answer for you it does mean there is a common bug somewhere in the service-wrapper feature.
I’m assuming the wrapper feature is part of Karaf and not OpenHab core but where to go from here, I’m not sure.
I’ll have a look around and let you know if I find anything.
Hopefully there’s more users out there using Windows that could help
I run OH on a Windows mini-computer and I do see that extra folder when I run it as a service. However, I have no explanation. Since upgrading to 3.4 I now run OH in the foreground since I was getting java heap related crashes when running it as a service.
I think I have found the problem!
Now that I know it wasn’t just my config I just needed to look deeper.
It seems that’s the default Karaf Log folder is created as /log under the Karaf Base folder. In this case the base folder is C:\OpenHab\userdata which is set in the /etc/openHAB-wrapper.conf file
The problem is the Default Karaf log folder is not set in that config file so stays at the /log default.
I added the line below to the wrapper config after %OPENHAB_USERDATA% is set, Deleted the /log folder and restarted the service.
The folder did not reappear.
Try it out and let me know if it works for you.
I think the Docs need to be changed to include that extra line. If the above works for you I’ll do a PR on the Docs.