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

Log messages emits to screen on FreeBSD #56

Closed
rainlance opened this issue Aug 13, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@rainlance
Copy link

commented Aug 13, 2018

Log messages does not emit to syslog but to console (tty/stdout). With a working log handler, messages are emitted both to log and to console.

Thank you for supporting FreeBSD in The Onion Box !!

@ralphwetzel

This comment has been minimized.

Copy link
Owner

commented Aug 14, 2018

By default, log messages shall emit to console (only).
If The Onion Box is operated as a service, log messages are emitted to syslog (only).

Do you observe this pattern of operation - or a different one?

@rainlance

This comment has been minimized.

Copy link
Author

commented Aug 15, 2018

Log messages are emitted to console even when The Onion Box operated as a service. Pull request #61 fixes the issue.

ralphwetzel added a commit that referenced this issue Aug 18, 2018

Potential fix to redirect stdout to syslog on FreeBSD (*BSD) systems …
…in case _The Onion Box_ is operated as system service / daemon. Shall address #56.
@ralphwetzel

This comment has been minimized.

Copy link
Owner

commented Aug 18, 2018

@rainlance: Thank you for providing a PR. Unfortunately this just suppresses the messages to be emitted to stdout - yet they are not (re)directed to syslog:

daemon(8):
-f Redirect standard input, standard output and standard error to /dev/null.

3028910 was committed to add this redirecting functionality to the launcher script for FreeBSD. Could you please verify if this works, as I don't have a test system available currently.

@yurivict: If confirmed, there is another dependency that needs to be taken care of: logger.

@yurivict

This comment has been minimized.

Copy link

commented Aug 18, 2018

The redirect is wrong for the Bourne shell
3028910#diff-c441889cc16437ae2d8b40dc1ec6e662R50

$ sudo service theonionbox onestart
eval: 1: Syntax error: redirection unexpected (expecting word)
eval: 1: Syntax error: Error in command substitution
@rainlance

This comment has been minimized.

Copy link
Author

commented Aug 18, 2018

@ralphwetzel Tor behaves exactly the same way as The Onion Box emitting messages directly to the shell during startup. So I guess this behavior should be OK. It is just unusual for service on FreeBSD to act like this. They usually only emit messages to their own logs or one of the systems logs.

There is some background info in the handbook on the topic:
https://www.freebsd.org/doc/handbook/configtuning-syslog.html

@yurivict

This comment has been minimized.

Copy link

commented Aug 18, 2018

IMO, the right way is to have a command line option to use system log, and to use a python library to write to it.

@rainlance

This comment has been minimized.

Copy link
Author

commented Aug 18, 2018

I agree @yurivict. Seems like FreeBSD needs a dedicated SysLogHandler. Here is an Python example using the logging.getLogger() method: https://forums.freebsd.org/threads/python-sysloghandler-no-working.61049/

ralphwetzel added a commit that referenced this issue Aug 19, 2018

Potential fix to redirect stdout to syslog on FreeBSD (*BSD) systems …
…in case _The Onion Box_ is operated as system service / daemon. Shall address #56.
@ralphwetzel

This comment has been minimized.

Copy link
Owner

commented Aug 19, 2018

@rainlance My expectation is that a service send his output to syslog. I'm surprised that Tor, as you describe, emits to stdout. The Onion Box shall use syslog, when running as a service.

@yurivict A(nother) dedicated command line option adds complexity, especially for inexperienced users. Thus I'd rather find a way to transparently redirect stdout/stderr to syslog, even if it needs some iterations. Perhaps you could check if 2e95ba9 performs better...

ralphwetzel added a commit that referenced this issue Aug 19, 2018

Potential fix to redirect stdout to syslog on FreeBSD (*BSD) systems …
…in case _The Onion Box_ is operated as system service / daemon. Shall address #56.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.