Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .build/parent-pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,27 +397,27 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.36</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.36</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.12</version>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.12</version>
<version>1.5.18</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
5.0.6
* Upgrade logback version to 1.5.18 and slf4j dependencies to 2.0.17 (CASSANDRA-20429)
* Fix range queries on early-open BTI files (CASSANDRA-20976)
* Avoid re-initializing underlying iterator in LazilyInitializedUnfilteredRowIterator after closing (CASSANDRA-20972)
* Flush SAI segment builder when current SSTable writer is switched (CASSANDRA-20752)
Expand Down
10 changes: 4 additions & 6 deletions conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ appender reference in the root level section below.
-->

<configuration scan="true" scanPeriod="60 seconds">
<jmxConfigurator />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this


<!-- No shutdown hook; we run it ourselves in StorageService after shutdown -->

<!-- SYSTEMLOG rolling file appender to system.log (INFO level) -->
Expand All @@ -43,7 +41,7 @@ appender reference in the root level section below.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -60,7 +58,7 @@ appender reference in the root level section below.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -80,7 +78,7 @@ appender reference in the root level section below.
<level>INFO</level>
</filter>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -98,7 +96,7 @@ appender reference in the root level section below.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender> -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ the rolling policy.

Specify the format of the message. Part of the rolling policy.

*Example:* <maxHistory>7</maxHistory> *Example:* <encoder>
<pattern>%-5level [%thread] %date\{ISO8601} %F:%L - %msg%n</pattern>
*Example:* <encoder>
<pattern>%-5level [%thread] %date\{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>

=== Logging to Cassandra virtual table
Expand Down Expand Up @@ -106,7 +106,6 @@ The appender to virtual table is commented out by default so logging to virtual
[source,XML]
----
<configuration scan="true" scanPeriod="60 seconds">
<jmxConfigurator />

<!-- No shutdown hook; we run it ourselves in StorageService after shutdown -->

Expand All @@ -126,7 +125,7 @@ The appender to virtual table is commented out by default so logging to virtual
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -143,7 +142,7 @@ The appender to virtual table is commented out by default so logging to virtual
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -163,7 +162,7 @@ The appender to virtual table is commented out by default so logging to virtual
<level>INFO</level>
</filter>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ the audit log events to flow through separate log file instead of system.log.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ default int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion,
* If classQualifer is not empty but level is empty/null, it will set the level to null for the defined classQualifer<br>
* If level cannot be parsed, then the level will be defaulted to DEBUG<br>
* <br>
* The logback configuration should have {@code < jmxConfigurator />} set
*
* @param classQualifier The logger's classQualifer
* @param level The log level
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/tools/NodeProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ public void setLoggingLevel(String classQualifier, String level)
}
catch (Exception e)
{
throw new RuntimeException("Error setting log for " + classQualifier + " on level " + level + ". Please check logback configuration and ensure to have <jmxConfigurator /> set", e);
throw new RuntimeException("Error setting log for " + classQualifier + " on level " + level + ". Please check logback configuration.", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,28 @@

package org.apache.cassandra.utils.logging;

import java.lang.management.ManagementFactory;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import javax.management.JMX;
import javax.management.ObjectName;

import org.apache.cassandra.security.ThreadAwareSecurityManager;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;

import com.google.common.collect.Maps;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.jmx.JMXConfiguratorMBean;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.TurboFilterList;
import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.classic.util.ContextInitializer;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.hook.DelayingShutdownHook;
import ch.qos.logback.core.hook.DefaultShutdownHook;
import org.apache.cassandra.security.ThreadAwareSecurityManager;

/**
* Encapsulates all logback-specific implementations in a central place.
Expand Down Expand Up @@ -92,7 +87,7 @@ public void onStartup()
@Override
public void onShutdown()
{
DelayingShutdownHook logbackHook = new DelayingShutdownHook();
DefaultShutdownHook logbackHook = new DefaultShutdownHook();
logbackHook.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
logbackHook.run();
}
Expand All @@ -105,10 +100,9 @@ public void setLoggingLevel(String classQualifier, String rawLevel) throws Excep
// if both classQualifier and rawLevel are empty, reload from configuration
if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel))
{
JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
JMXConfiguratorMBean.class);
jmxConfiguratorMBean.reloadDefaultConfiguration();
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();
new ContextInitializer(lc).autoConfig();
return;
}
// classQualifier is set, but blank level given
Expand Down
6 changes: 3 additions & 3 deletions test/conf/logback-burntest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<define name="instance_id" class="org.apache.cassandra.distributed.impl.InstanceIDDefiner" />

<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">

Expand All @@ -36,7 +36,7 @@
</triggeringPolicy>

<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<immediateFlush>false</immediateFlush>
</appender>
Expand All @@ -51,7 +51,7 @@

<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<filter class="org.apache.cassandra.net.LogbackFilter"/>
</appender>
Expand Down
8 changes: 4 additions & 4 deletions test/conf/logback-dtest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
<define name="instance_id" class="org.apache.cassandra.distributed.impl.InstanceIDDefiner" />

<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>

<appender name="INSTANCEFILE" class="ch.qos.logback.core.FileAppender">
<file>./build/test/logs/${cassandra.testtag}/${suitename}/${cluster_id}/${instance_id}/system.log</file>
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<immediateFlush>true</immediateFlush>
</appender>

<appender name="INSTANCESTDERR" target="System.err" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level %date{HH:mm:ss,SSS} %msg%n</pattern>
<pattern>%-5level %date{"HH:mm:ss,SSS"} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
Expand All @@ -43,7 +43,7 @@

<appender name="INSTANCESTDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
Expand Down
8 changes: 4 additions & 4 deletions test/conf/logback-dtest_with_vtable_appender.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
<define name="instance_id" class="org.apache.cassandra.distributed.impl.InstanceIDDefiner" />

<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>

<appender name="INSTANCEFILE" class="ch.qos.logback.core.FileAppender">
<file>./build/test/logs/${cassandra.testtag}/${suitename}/${cluster_id}/${instance_id}/system.log</file>
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<immediateFlush>true</immediateFlush>
</appender>

<appender name="INSTANCESTDERR" target="System.err" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level %date{HH:mm:ss,SSS} %msg%n</pattern>
<pattern>%-5level %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
Expand All @@ -42,7 +42,7 @@

<appender name="INSTANCESTDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
Expand Down
8 changes: 4 additions & 4 deletions test/conf/logback-dtest_with_vtable_appender_invalid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
<define name="instance_id" class="org.apache.cassandra.distributed.impl.InstanceIDDefiner" />

<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>

<appender name="INSTANCEFILE" class="ch.qos.logback.core.FileAppender">
<file>./build/test/logs/${cassandra.testtag}/${suitename}/${cluster_id}/${instance_id}/system.log</file>
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<immediateFlush>true</immediateFlush>
</appender>

<appender name="INSTANCESTDERR" target="System.err" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level %date{HH:mm:ss,SSS} %msg%n</pattern>
<pattern>%-5level %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
Expand All @@ -42,7 +42,7 @@

<appender name="INSTANCESTDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
Expand Down
7 changes: 3 additions & 4 deletions test/conf/logback-jmh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ appender reference in the root level section below.
-->

<configuration scan="false" scanPeriod="60 seconds">
<jmxConfigurator />
<!-- No shutdown hook; we run it ourselves in StorageService after shutdown -->

<!-- SYSTEMLOG rolling file appender to system.log (INFO level) -->
Expand All @@ -42,7 +41,7 @@ appender reference in the root level section below.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -59,7 +58,7 @@ appender reference in the root level section below.
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender>

Expand All @@ -79,7 +78,7 @@ appender reference in the root level section below.
<level>INFO</level>
</filter>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
</appender-->

Expand Down
6 changes: 3 additions & 3 deletions test/conf/logback-simulator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
<define name="instance_id" class="org.apache.cassandra.distributed.impl.InstanceIDDefiner" />

<!-- Shutdown hook ensures that async appender flushes -->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<shutdownHook class="ch.qos.logback.core.hook.DefaultShutdownHook"/>

<appender name="INSTANCEFILE" class="ch.qos.logback.core.FileAppender">
<file>./build/test/logs/${cassandra.testtag}/${suitename}/${cluster_id}/${instance_id}/system.log</file>
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %msg%n</pattern>
</encoder>
<immediateFlush>true</immediateFlush>
</appender>

<appender name="STDOUT" target="System.out" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-5level [%thread] ${instance_id} %date{ISO8601} %F:%L - %msg%n</pattern>
<pattern>%-5level [%thread] ${instance_id} %date{"yyyy-MM-dd'T'HH:mm:ss,SSS", UTC} %F:%L - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
Expand Down
Loading