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

Logs to stderr? not good for tee command for example #25

Open
boussou opened this issue Jul 8, 2021 · 4 comments
Open

Logs to stderr? not good for tee command for example #25

boussou opened this issue Jul 8, 2021 · 4 comments

Comments

@boussou
Copy link

boussou commented Jul 8, 2021

hello, why choosing to log to stderr?

I wanted to tee the logs, and I am forced to write this:

redir --lport=XXX --laddr=$ME --cport=XXX --caddr=$target -l info 2>&1 | tee /var/log/redir-`date +%Y-%m-%d-%H%m%S`.log

the trick is " 2>&1 ".
It works, but it is far from perfect for use (you can lose the log depending on what happens to the console)

Why not directly logging to STDOUT as usual?

Best, I would love to be able to log to /var/log, in a separate file, with a format like info level, improved with the timestamp and the PEER IP
ie

timestamp: Connecting PEER:port => TARGET:port
@boussou
Copy link
Author

boussou commented Jul 8, 2021

Also, the info level is weird, IMHO it shall display the PEER and the Target IPs (currently is displays only peer)

@boussou
Copy link
Author

boussou commented Jul 8, 2021

I just thougth about a way using syslog config and the related cmdline option. That is still heavier stuff for the user than specifying an output file name (but i suppose you are using the syslog() ufnction from syslog.h so it may require additional code)

@troglobit
Copy link
Owner

Hi! Because we use the syslog() API and when running in the foreground like that it currently activates LOG_PERROR. We can of course add support for wrapping a syslog() calls in a logit() or similar function where we can do whatever we like.

@boussou
Copy link
Author

boussou commented Jul 14, 2021

Understood.
if I have time this summer I could try to propose a patch. wrapping syslog calls plus a new cmdline option, that should not be a big deal. and the code of redir is KISS ;-)

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

No branches or pull requests

2 participants