Cassandra
  1. Cassandra
  2. CASSANDRA-4273

Write auxiliary info to the system's error stream and not to the std output.

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Invalid
    • Fix Version/s: None
    • Component/s: API, Tools
    • Labels:
    • Environment:

      Ubuntu 10.04 LTS with Sun Java 1.6.0.26
      Using Cassandra without JNA

      Description

      When executing a Cassandra script from the terminal then all output is written to the standard output stream of the system. For example if we create a file called my_script with the following commands:

      use MyKeyspace;
      show schema;

      and we execute it as:

      cassandra-cli < my_script > my.scm

      then the output file my.scm will also contain lines like:

      Connected to: "Test Cluster" on 127.0.0.1/9160
      Welcome to Cassandra CLI version 1.2.0-SNAPSHOT

      Type 'help;' or '?' for help.
      Type 'quit;' or 'exit;' to quit.

      or

      Authenticated to keyspace: MyKeyspace

      Would be good to write such information to the system error stream so that one would be able to do:

      cassandra-cli < my_script > my.scm 2> /dev/null

        Activity

        Pantelis Sopasakis created issue -
        Hide
        Jonathan Ellis added a comment -

        You can use SOURCE and CAPTURE commands in cqlsh to do what you want. May be similar options for the cli.

        Show
        Jonathan Ellis added a comment - You can use SOURCE and CAPTURE commands in cqlsh to do what you want. May be similar options for the cli.
        Jonathan Ellis made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        Pantelis Sopasakis added a comment -

        Yes, I indeed can do the same with CQLSH but wouldn't it be better to provide similar functionality for cassandra-cli?

        Show
        Pantelis Sopasakis added a comment - Yes, I indeed can do the same with CQLSH but wouldn't it be better to provide similar functionality for cassandra-cli?
        Hide
        Jonathan Ellis added a comment -

        I'm open to a patch if indeed it doesn't already exist. Not a fan of putting non-error output on stderr tho.

        Show
        Jonathan Ellis added a comment - I'm open to a patch if indeed it doesn't already exist. Not a fan of putting non-error output on stderr tho.
        Hide
        Pantelis Sopasakis added a comment -

        All loggers for Java I know (LOG4J, Java Logger, etc) output their logs to stderr. Logs can be - among other - informatory messages. Additionally, stderr (or stream #2) can be seen as a different stream from stdout (or stream #1). This aims at separating actual (machine readable) output of a program from human-readable information (that's why you have the pipes > and 2>). I guess this output is generated by some System.out.println (since Cassandra is written in Java). This can be changed using logger.info(message);.

        Show
        Pantelis Sopasakis added a comment - All loggers for Java I know (LOG4J, Java Logger, etc) output their logs to stderr. Logs can be - among other - informatory messages. Additionally, stderr (or stream #2) can be seen as a different stream from stdout (or stream #1). This aims at separating actual (machine readable) output of a program from human-readable information (that's why you have the pipes > and 2>). I guess this output is generated by some System.out.println (since Cassandra is written in Java). This can be changed using logger.info(message);.
        Hide
        Jonathan Ellis added a comment -

        But we're not talking about log messages.

        Show
        Jonathan Ellis added a comment - But we're not talking about log messages.
        Gavin made changes -
        Workflow no-reopen-closed, patch-avail [ 12669084 ] patch-available, re-open possible [ 12749756 ]
        Gavin made changes -
        Workflow patch-available, re-open possible [ 12749756 ] reopen-resolved, no closed status, patch-avail, testing [ 12757238 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Pantelis Sopasakis
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development