Skip to content

bt-agent: add option to redirect stdout and stderr to syslog#57

Open
corviv wants to merge 1 commit intokhvzak:masterfrom
corviv:master
Open

bt-agent: add option to redirect stdout and stderr to syslog#57
corviv wants to merge 1 commit intokhvzak:masterfrom
corviv:master

Conversation

@corviv
Copy link
Copy Markdown

@corviv corviv commented Nov 6, 2024

Add handlers for g_print() and g_printerr() methods to redirect output to syslog.

Add the corresponding option to use it.

Add handlers for g_print() and g_printerr() methods to
redirect output to syslog.

Add corresponding option.

Signed-off-by: Victor Pushkarev <VAnPushkarev@salutedevices.com>
@WhyNotHugo
Copy link
Copy Markdown

Can't we just pipe to logger(1)?

@corviv
Copy link
Copy Markdown
Author

corviv commented Jul 1, 2025

Can't we just pipe to logger(1)?

Hi @WhyNotHugo
I've added --syslog/-s mainly for Buildroot, but it helps in any minimal image (BusyBox, Alpine, small containers, etc.):

  • zero extra deps: no external logger(1) needed → smaller rootfs;
  • no extra forks — logs go straight through syslog();
  • correct severity (LOG_INFO/LOG_ERR) even if stdout/err are closed;
  • optional, default-off.

It also integrates cleanly with systemd-journald because /dev/log is forwarded automatically.
Thanks for feedback.

@WhyNotHugo
Copy link
Copy Markdown

busybox includes logger(1).

@corviv
Copy link
Copy Markdown
Author

corviv commented Jul 1, 2025

Correct, busybox can include logger(1), but it’s an optional applet that many size-optimised Buildroot or container configs leave out (CONFIG_LOGGER option).
Besides, even when it exists, every log line goes through a separate fork()+exec() + see previous arguments.

So the option mainly removes a conditional dependency and gives tighter resource control, while staying completely optional.

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.

2 participants