runsv not redirecting standard error output, why?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
According to the runsv man page:
If the directory service/log exists, runsv creates a pipe, redirects
service/run's and service/finish's standard output to the pipe,
switches to the directory service/log and starts ./run script. The
standard input of the log service is redirected to read from the pipe.
Obviously, runsv only redirects service's standard output, but not standard
error output, to svlogd standard input. My question is: why? Of course I want
to log my unit's standard error output; why do I have to pay extra attention
to adding exec 2>&1 to the beginning of each unit file?
Cheers!
logs init runit
add a comment |Â
up vote
0
down vote
favorite
According to the runsv man page:
If the directory service/log exists, runsv creates a pipe, redirects
service/run's and service/finish's standard output to the pipe,
switches to the directory service/log and starts ./run script. The
standard input of the log service is redirected to read from the pipe.
Obviously, runsv only redirects service's standard output, but not standard
error output, to svlogd standard input. My question is: why? Of course I want
to log my unit's standard error output; why do I have to pay extra attention
to adding exec 2>&1 to the beginning of each unit file?
Cheers!
logs init runit
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
According to the runsv man page:
If the directory service/log exists, runsv creates a pipe, redirects
service/run's and service/finish's standard output to the pipe,
switches to the directory service/log and starts ./run script. The
standard input of the log service is redirected to read from the pipe.
Obviously, runsv only redirects service's standard output, but not standard
error output, to svlogd standard input. My question is: why? Of course I want
to log my unit's standard error output; why do I have to pay extra attention
to adding exec 2>&1 to the beginning of each unit file?
Cheers!
logs init runit
According to the runsv man page:
If the directory service/log exists, runsv creates a pipe, redirects
service/run's and service/finish's standard output to the pipe,
switches to the directory service/log and starts ./run script. The
standard input of the log service is redirected to read from the pipe.
Obviously, runsv only redirects service's standard output, but not standard
error output, to svlogd standard input. My question is: why? Of course I want
to log my unit's standard error output; why do I have to pay extra attention
to adding exec 2>&1 to the beginning of each unit file?
Cheers!
logs init runit
asked Feb 27 at 12:16
David
1687
1687
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Actually, you don't.
runsv takes this behaviour from svscan in the original Bernstein daemontools, which did the same. Almost everyone else has copied it. Bruce Guenter's svscan from daemontools-encore, Laurent Bercot's s6-svscan from s6, and Wayne Marshall's perpd from perp all do likewise.
Even Adam Sampson's svscan from freedt connects only standard output, despite calling the file descriptor err in the code. âº
Noticing how extensively exec 2>&1 and fdmove -c 2 1 had become the norm, and observing that some programming languages explicitly define a standard log stream that ends up being file descriptor 2 (e.g. std::clog in C++), I made service-manager in the nosh toolset connect both standard output and standard error to the pipe when plumbing services together.
Further reading
- Jonathan de Boyne Pollard (2014). A side-by-side look at run scripts and service units.. Frequently Given Answers.
- Jonathan de Boyne Pollard (2015). "Logging". The daemontools family. Frequently Given Answers.
- https://unix.stackexchange.com/a/294206/5132
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirectstdoutbut notstderr? Because that's what I'm interested in in the first place.
â David
Feb 28 at 8:14
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Actually, you don't.
runsv takes this behaviour from svscan in the original Bernstein daemontools, which did the same. Almost everyone else has copied it. Bruce Guenter's svscan from daemontools-encore, Laurent Bercot's s6-svscan from s6, and Wayne Marshall's perpd from perp all do likewise.
Even Adam Sampson's svscan from freedt connects only standard output, despite calling the file descriptor err in the code. âº
Noticing how extensively exec 2>&1 and fdmove -c 2 1 had become the norm, and observing that some programming languages explicitly define a standard log stream that ends up being file descriptor 2 (e.g. std::clog in C++), I made service-manager in the nosh toolset connect both standard output and standard error to the pipe when plumbing services together.
Further reading
- Jonathan de Boyne Pollard (2014). A side-by-side look at run scripts and service units.. Frequently Given Answers.
- Jonathan de Boyne Pollard (2015). "Logging". The daemontools family. Frequently Given Answers.
- https://unix.stackexchange.com/a/294206/5132
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirectstdoutbut notstderr? Because that's what I'm interested in in the first place.
â David
Feb 28 at 8:14
add a comment |Â
up vote
1
down vote
Actually, you don't.
runsv takes this behaviour from svscan in the original Bernstein daemontools, which did the same. Almost everyone else has copied it. Bruce Guenter's svscan from daemontools-encore, Laurent Bercot's s6-svscan from s6, and Wayne Marshall's perpd from perp all do likewise.
Even Adam Sampson's svscan from freedt connects only standard output, despite calling the file descriptor err in the code. âº
Noticing how extensively exec 2>&1 and fdmove -c 2 1 had become the norm, and observing that some programming languages explicitly define a standard log stream that ends up being file descriptor 2 (e.g. std::clog in C++), I made service-manager in the nosh toolset connect both standard output and standard error to the pipe when plumbing services together.
Further reading
- Jonathan de Boyne Pollard (2014). A side-by-side look at run scripts and service units.. Frequently Given Answers.
- Jonathan de Boyne Pollard (2015). "Logging". The daemontools family. Frequently Given Answers.
- https://unix.stackexchange.com/a/294206/5132
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirectstdoutbut notstderr? Because that's what I'm interested in in the first place.
â David
Feb 28 at 8:14
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Actually, you don't.
runsv takes this behaviour from svscan in the original Bernstein daemontools, which did the same. Almost everyone else has copied it. Bruce Guenter's svscan from daemontools-encore, Laurent Bercot's s6-svscan from s6, and Wayne Marshall's perpd from perp all do likewise.
Even Adam Sampson's svscan from freedt connects only standard output, despite calling the file descriptor err in the code. âº
Noticing how extensively exec 2>&1 and fdmove -c 2 1 had become the norm, and observing that some programming languages explicitly define a standard log stream that ends up being file descriptor 2 (e.g. std::clog in C++), I made service-manager in the nosh toolset connect both standard output and standard error to the pipe when plumbing services together.
Further reading
- Jonathan de Boyne Pollard (2014). A side-by-side look at run scripts and service units.. Frequently Given Answers.
- Jonathan de Boyne Pollard (2015). "Logging". The daemontools family. Frequently Given Answers.
- https://unix.stackexchange.com/a/294206/5132
Actually, you don't.
runsv takes this behaviour from svscan in the original Bernstein daemontools, which did the same. Almost everyone else has copied it. Bruce Guenter's svscan from daemontools-encore, Laurent Bercot's s6-svscan from s6, and Wayne Marshall's perpd from perp all do likewise.
Even Adam Sampson's svscan from freedt connects only standard output, despite calling the file descriptor err in the code. âº
Noticing how extensively exec 2>&1 and fdmove -c 2 1 had become the norm, and observing that some programming languages explicitly define a standard log stream that ends up being file descriptor 2 (e.g. std::clog in C++), I made service-manager in the nosh toolset connect both standard output and standard error to the pipe when plumbing services together.
Further reading
- Jonathan de Boyne Pollard (2014). A side-by-side look at run scripts and service units.. Frequently Given Answers.
- Jonathan de Boyne Pollard (2015). "Logging". The daemontools family. Frequently Given Answers.
- https://unix.stackexchange.com/a/294206/5132
answered Feb 27 at 21:51
JdeBP
28.3k459133
28.3k459133
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirectstdoutbut notstderr? Because that's what I'm interested in in the first place.
â David
Feb 28 at 8:14
add a comment |Â
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirectstdoutbut notstderr? Because that's what I'm interested in in the first place.
â David
Feb 28 at 8:14
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirect
stdout but not stderr? Because that's what I'm interested in in the first place.â David
Feb 28 at 8:14
Thanks for answer! Do you have any explanation why daemontools' original behaviour was to only redirect
stdout but not stderr? Because that's what I'm interested in in the first place.â David
Feb 28 at 8:14
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426921%2frunsv-not-redirecting-standard-error-output-why%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password