Reputation: 3136
I am starting up a Cassandra instance with my own start up script that sets the CASSANDRA_CONF directory (which is outside of the CASSANDRA_HOME directory).
export CASSANDRA_CONF=/path/to/conf
cassandra -f -Dcassandra.config=file://path/to/yaml
When the process begins, I noticed that the logs are not respecting my log4j-server.properties file. After further investigation, it seems as though the log4j-server.properties file is not being picked up even though a reference to it appears in command line arguments generated by Cassandra:
-Dlog4j.configuration=log4j-server.properties
In the script, I output the contents of the log4j-server.properties file to make sure it was at least reading from the right place and it was. Is there some configuration option I'm missing that makes Cassandra read from the log4j-server.properties file?
Upvotes: 2
Views: 2799
Reputation: 3514
Which version are you running? If you're running 2.1+ (which is not currently a stable build), there has been a switch from log4j to logback, and your old configuration files will no longer affect anything.
Logback is configured through xml files, and the argument you'd have to use is -Dlogback.configurationFile=logback.xml
More details about the switch here.
Here is an example config that is currently checked in.
<configuration scan="true">
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/var/log/cassandra/system.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>/var/log/cassandra/system.log.%i.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>20</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>20MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<!-- old-style log format
<pattern>%5level [%thread] %date{ISO8601} %F (line %L) %msg%n</pattern>
-->
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level %date{HH:mm:ss,SSS} %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
<logger name="com.thinkaurelius.thrift" level="ERROR"/>
</configuration>
Upvotes: 3