tdeckers / docker-openhab

Docker image for Openhab
33 stars 41 forks source link

I'm not clear on how to get the logdir to work? #6

Closed richardpowellus closed 9 years ago

richardpowellus commented 9 years ago

It seems that by default openhab will put the log files in a java environment variable openhab.logdir but I don't see any way to control that since it needs to be passed into the java command like -Dopenhab.logdir ?

I've tried mounting /var/log/openhab but I don't see any log files showing up there.

One thing I did get to work was to create a logback.xml and tell it to explicitly write the log files to /var/log/openhab but unfortunately it appears as though some plugins rely on openhab.logdir to find the log files.

The immediately obvious solution would be to change this docker image so that it passes in the environment variable, say, OPENHAB_LOGDIR into Java when launching OpenHAB so that the logdir gets set when I do: "docker run -e OPENHAB_LOGDIR=/var/log/openhab" but I wanted to be sure I wasn't missing anything obvious before messing with making changes to the image :)

tdeckers commented 9 years ago

The container is using supervisord to control the openhab process and expose the log files. Can you export the supervisord port (add -p 9001:9001) and then access the UI at http://:9001. This will present a webui that allows you to start/stop openhab and view/tail the log file. This approach avoids tight coupling to files on the container file system, but exposes an endpoint instead.

richardpowellus commented 9 years ago

Wow, awesome. That worked perfectly. Thanks!