Hammar
(Hammar)
1
Has anyone managed to redirect the openhab logs to Docker logs?
I know that Docker logs use stdout for pid 1 but I have struggled to achieve the goal. I have tried:
- Symbolic linking of openhab.log to stdout
- tail of the openhab.log
But no luck so far.
psyciknz
(Psyciknz)
2
In unifi I have a logs container:
logs:
image: bash
depends_on:
- controller
command: bash -c 'tail -f /unifi/log/*'
restart: always
volumes:
- log:/unifi/log
The important bit is - log:/unifi/log
this has to be the same volume (named volume) as where unifi wirtes it’s logs to.
I think you could do the same with openhab.
Set the logs of openhab to:
volumes:
- log:/openhab/userdata/logs
Create the log container:
ohlogs:
image: bash
depends_on:
- controller
command: bash -c 'tail -f /openhab/*'
restart: always
volumes:
- log:/openhab/
Then the openhab logs container would have all the logs for you (that you can then run `docker logs -f ohlogs’
I haven’t tried this, but there’s no reason it wouldn’t work.
wborn
(Wouter Born)
3
Just add a console logger like explained in the readme:
4 Likes
Hammar
(Hammar)
5
Works like a charm. Thanks!
1 Like