runsv not redirecting standard error output, why?

The name of the pictureThe name of the pictureThe name of the pictureClash 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!







share|improve this question
























    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!







    share|improve this question






















      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!







      share|improve this question












      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!









      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 27 at 12:16









      David

      1687




      1687




















          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





          share|improve this answer




















          • 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










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          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






























          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





          share|improve this answer




















          • 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














          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





          share|improve this answer




















          • 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












          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





          share|improve this answer












          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          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 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















          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












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)