Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not close stdout/stderr on daemon #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rehno-lindeque
Copy link

@rehno-lindeque rehno-lindeque commented Jun 9, 2018

Currently, when actkbd is daemonized, the noclose argument is given as zero in order to prevent logging to stdout and stderr in the style of traditional non-interactive daemons.

For many people using systemd, a service unit might contain something like this:

[Service]
Type=forking
ExecStart=/usr/bin/actkbd -c /.../actkbd.conf -d /dev/input/event2 --daemon

where logs to stdout/stderr should normally show up via journalctl -u actkbd.

However, since logging is turned off by the --daemon flag, this causes a huge amount of confusion when the environment from which actkbd is being executed lacks the correct permissions / environment variables for the commands you are running.

Additional motivating points:

  • A possible alternative solution is to not use --daemon and instead create a systemd unit of Type=simple. However, this seems to have its own downsides.
  • Using syslog is an alternative option, but it is a rather complicated solution to a simple problem. E.g. on my system adding -l segfaults, leading the average jane/joe down the peculiar unixy rabbit hole that is "What is this thing X and why does it break my system?".
  • It is already super simple and clear how to turn off logging explicitly (via --quiet). Keeping the logs should be equally simple and, I'd argue, the correct default for most people.

@rehno-lindeque
Copy link
Author

PS thank you for the opportunity to rant at length about a 1 character commit!

Currently, when actkbd is daemonized, the [noclose argument](http://man7.org/linux/man-pages/man3/daemon.3.html#DESCRIPTION) is given as zero in order to prevent logging to stdout and stderr in the style of traditional non-interactive daemons.

For many people using systemd, a service unit might contain something like this:

```
[Service]
Type=forking
ExecStart=/usr/bin/actkbd -c /.../actkbd.conf -d /dev/input/event2 --daemon
```
where logs to stdout/stderr should normally show up via `journalctl -u actkbd`.

However, since logging is turned off by the `--daemon` flag, this causes a huge amount of confusion when the environment from which `actkbd` is being executed lacks the correct permissions / environment variables for the commands you are running.

Additional motivating points:

* A possible alternative solution is to *not* use `--daemon` and instead create a systemd unit of `Type=simple`. However, this seems to have its [own downsides](https://www.lucas-nussbaum.net/blog/?p=877).
* Using syslog is an alternative option, but it is a rather complicated solution to a simple problem. E.g. on my system adding `-l` segfaults, leading the average jane/joe down the peculiar unixy rabbit hole that is "What is this thing X and why does it break my system?".
* It is already super simple and clear how to turn off logging explicitly (via `--quiet`). *Keeping* the logs should be equally simple and, I'd argue, the correct default for most people.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant