Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-14947

in the tarball download of cassandra 3.11.3 there is an issue redirecting system.log and debug.log via $cassandra.logdir

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Low
    • Resolution: Unresolved
    • 3.11.x
    • Local/Config
    • None
    • Low

    Description

      it would appear that for some reason setting an env variable of CASSANDRA_LOG_DIR is only being picked up in cassandra-env.ps1 & cassandra-env.sh and being passed to java for the gc.log*  files.

      cassandra-env.ps1:    line 288:     $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra.logdir=""$logdir"" -Dcassandra.storagedir=""$storagedir"""

       

      However in logback.xml  the same environment variable CASSANDRA_LOG_DIR is not being picked up and passed to  (${cassandra.logdir})  

      while gc.log gets redirected correctly to CASSANDRA_LOG_DIR from the java argument -Xloggc:

       

      the system.log and debug.log defined in logback.xml still points to $CASSANDRA_HOME/log.

      The only way I can get the debug.log and system.log log files to redirect to $CASSANDRA_LOG_DIR

      is to edit the logback.xml and change the following lines manually;

       

      <!-- <file>${cassandra.logdir}/system.log</file> -->
      <file>/var/log/cassandra/system.log</file>
      <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <!-- <fileNamePattern>${cassandra.logdir}/system.log.%i.zip</fileNamePattern> -->

       <fileNamePattern>/var/log/cassandra/system.log.%i.zip</fileNamePattern>

       

      ........

      <!-- <file>${cassandra.logdir}/debug.log</file> -->
      <file>/var/log/cassandra/debug.log</file>
      <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <!-- <fileNamePattern>${cassandra.logdir}/debug.log.%i.zip</fileNamePattern> -->
      <fileNamePattern>/var/log/cassandra/debug.log.%i.zip</fileNamePattern>

      >> I don't know why the environment variable CASSANDRA_LOG_DIR is being picked up by  cassandra-env.ps1 & cassandra-env.sh

      but not logback.xml

       

      Indeed the only way I could even get cassandra-env.sh to pick up CASSANDRA_LOG_DIR environment variable was to make the following change to cassandra-env.sh;

      old: JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"

      new: if [ "x$CASSANDRA_LOG_DIR" = "x" ]; then

      JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
      else
      JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_LOG_DIR}/gc.log"
      fi 

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            simonboydfoley simon
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: