Closed theryangeary closed 5 years ago
Sorry that I caused you problems with my commit. I just re-checked – it works on my system. A few ideas how to get closer to the cause of this:
Loggin started ...
) or is "just" the key logging missing?log_event()
is called at all?log_event()
is being called.Found it! It appears as though the file is being opened with a relative path (i.e. if I say -o keys.log
it will put it in the CWD of the process) but the process CWD appears to actually be the root directory /
, so it ends up writing it to /keys.log
when I was expecting it to be in $PWD/keys.log
.
The culprit is daemon(3)
call, which is passed nochdir=0
and which since fff9d1d60f85a09208935170940c14ef7604b9d0 happens before the log file is opened.
https://github.com/kernc/logkeys/blob/2e33f93efdf11bafee26a987355c82ce913a41c3/src/logkeys.cc#L705
The simple options I see, not in preferential order:
log_loop()
.daemon(nochdir=1)
.args.logfile
to absolute path before daemonization.
git bisect and testing shows that this commit introduces this issue:
It seems from an external standpoint that it simply isn't writing to the log file whatsoever. I'm running as
sudo logkeys -s -o keys.log
on Arch:Linux commodus 5.3.5-arch1-1-ARCH #1 SMP PREEMPT Mon Oct 7 19:03:08 UTC 2019 x86_64 GNU/Linux