Enabling and disabling debug logs for Cassandra and JanusGraph
Adjusting the logging level helps in troubleshooting performance or configuration issues by providing more detailed runtime information. This document describes how to enable and disable debug-level logging for Cassandra and JanusGraph.
Cassandra
Enabling DEBUG logs
- Backup the existing log configuration file with the command below.
cp /etc/cassandra/default.conf/logback.xml /etc/cassandra/default.conf/logback.xml_backup
- Edit the Cassandra log configuration file and copy all contents from below.
<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.See the NOTICE file distributed with this work for additional information regarding copyright ownership.The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitationsunder the License.--><!--In order to disable debug.log, comment-out the ASYNCDEBUGLOG appender reference in the root level section below.--><configuration scan="true" scanPeriod="60 seconds"><jmxConfigurator /><!-- SYSTEMLOG rolling file appender to system.log (INFO level) --><appender name="SYSTEMLOG" class="ch.qos.logback.core.rolling.RollingFileAppender"><filter class="ch.qos.logback.classic.filter.ThresholdFilter"><level>INFO</level></filter><file>${cassandra.logdir}/system.log</file><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><!-- rollover daily --><fileNamePattern>${cassandra.logdir}/system.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern><!-- each file should be at most 50MB, keep 7 days worth of history, but at most 5GB --><maxFileSize>50MB</maxFileSize><maxHistory>7</maxHistory><totalSizeCap>5GB</totalSizeCap></rollingPolicy><encoder><pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern></encoder></appender><!-- DEBUGLOG rolling file appender to debug.log (all levels) --><appender name="DEBUGLOG" class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${cassandra.logdir}/debug.log</file><rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"><!-- rollover daily --><fileNamePattern>${cassandra.logdir}/debug.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern><!-- each file should be at most 50MB, keep 7 days worth of history, but at most 5GB --><maxFileSize>50MB</maxFileSize><maxHistory>7</maxHistory><totalSizeCap>5GB</totalSizeCap></rollingPolicy><encoder><pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern></encoder></appender><!-- ASYNCLOG asynchronous appender to debug.log (all levels) --><appender name="ASYNCDEBUGLOG" class="ch.qos.logback.classic.AsyncAppender"><queueSize>1024</queueSize><discardingThreshold>0</discardingThreshold><includeCallerData>true</includeCallerData><appender-ref ref="DEBUGLOG" /></appender><!-- STDOUT console appender to stdout (INFO level) --><appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"><filter class="ch.qos.logback.classic.filter.ThresholdFilter"><level>INFO</level></filter><encoder><pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern></encoder></appender><root level="INFO"><appender-ref ref="SYSTEMLOG" /><appender-ref ref="STDOUT" /><appender-ref ref="ASYNCDEBUGLOG" /> <!-- Comment this line to disable debug.log --></root><logger name="org.apache.cassandra" level="DEBUG"/></configuration>
Use the following command.
vi /etc/cassandra/default.conf/logback.xml
- Modify the desired log level entries to DEBUG as required.
- Restart the Cassandra service to apply changes with the command below.
systemctl restart cassandra
- Verify service status as follows.
systemctl status cassandra
Disabling DEBUG logs
- Restore the original configuration file
cp /etc/cassandra/default.conf/logback.xml_backup /etc/cassandra/default.conf/logback.xml
- Restart the Cassandra service as follows.
systemctl restart cassandra
JanusGraph
Enabling DEBUG logs
- Backup the existing log configuration file.
cp /usr/local/openiam/janusgraph/conf/log4j-console.properties /usr/local/openiam/janusgraph/conf/log4j-console.properties_backup
- Edit the JanusGraph log configuration file with the following command.
vi /usr/local/openiam/janusgraph/conf/log4j-console.properties
- Update the following properties.
log4j.appender.A2.Threshold=DEBUGlog4j.rootLogger=DEBUG, A2
- Restart the JanusGraph service as follows.
systemctl restart janusgraph
- Verify service status:
systemctl status janusgraph
Disabling DEBUG Logs
- Modify the log level back to INFO.
log4j.appender.A2.Threshold=INFOlog4j.rootLogger=INFO, A2
- Restart the JanusGraph service as follows.
systemctl restart janusgraph
- Verify service status with the command below.
systemctl status janusgraph