gismo141 / homebridge-server

Server plugin for homebridge
https://gismo141.github.io/configure-your-homebridge-2/
152 stars 20 forks source link

systemd service log settings #11

Closed frodeaux closed 7 years ago

frodeaux commented 7 years ago

If using systemd to autostart homebridge, how would one configure the logs?

gismo141 commented 7 years ago

At the moment there isn't because systemd is logging into a binary-file instead of a simple text-file.

However I am already working on a solution to make that possible in the next version 😊

frodeaux commented 7 years ago

Thanks for the response, after an exhaustive search I came to the same conclusion. I'm new to systemd and I didn't find a good way to output the log to a text-file. I converted my startup process to inet.d and it works well. Does the package have to be installed via sudo?

gismo141 commented 7 years ago

Sorry for the trouble about your start script!

Normally you shouldn't need sudo for the installation.

I'll try to implement a solution for systemd in the coming days because it's very good in general.

Thanks for your patience and research! ;)

gismo141 commented 7 years ago

I've added now the possibility to use the journalctl-log with Homebridge!

What you need:

adapt your config.json for the server as follows:

{
    "platform": "Server",
    "port": 8765,
    "name": "Homebridge Server",
    "log" : "systemd"
}

And allow the user you're using to execute homebridge to read the journalctl-logs, whereas systemd-journal is the journalctl-group and homebridge is the user executing the homebridge-service:

sudo usermod -a -G systemd-journal homebridge

Finally restart the homebridge-service and keep on logging ;)

I'll close this issue as soon as I've added this info to the documentation! Hope you like it!