You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by if...@apache.org on 2020/04/16 11:14:32 UTC

[cassandra-in-jvm-dtest-api] branch master updated: Support for replacing logback with alternate logger config (like log4j2)

This is an automated email from the ASF dual-hosted git repository.

ifesdjeen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cassandra-in-jvm-dtest-api.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ddfe52  Support for replacing logback with alternate logger config (like log4j2)
7ddfe52 is described below

commit 7ddfe52d51639817c6c5be86c0c8e317e33620eb
Author: Jon Meredith <jm...@gmail.com>
AuthorDate: Fri Apr 10 12:04:40 2020 -0600

    Support for replacing logback with alternate logger config (like log4j2)
    
    Not all forks use logback, and there is an (prematurely) closed ticket
    indicating that it would be valuable CASSANDRA-13212.
    
    Also had to add 'org.w3c.dom' to the InstanceClassLoader so that
    log4j2 could load it's configuration.
    
    Patch by Jon Meredith; reviewed by David Capwell and Alex Petrov for CASSANDRA-15714.
---
 CHANGELOG.txt                                               |  4 ----
 .../java/org/apache/cassandra/distributed/api/ICluster.java | 13 +++++++------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
deleted file mode 100644
index 86a9490..0000000
--- a/CHANGELOG.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# 0.0.2
-
-CASSANDRA-15684: Improve error codes in NodeToolResult to produce better errors and to allow Any style message checks
-CASSANDRA-15713: Make shared class filter for InstanceClassLoader pluggable
diff --git a/src/main/java/org/apache/cassandra/distributed/api/ICluster.java b/src/main/java/org/apache/cassandra/distributed/api/ICluster.java
index 6546d95..a586311 100644
--- a/src/main/java/org/apache/cassandra/distributed/api/ICluster.java
+++ b/src/main/java/org/apache/cassandra/distributed/api/ICluster.java
@@ -28,6 +28,8 @@ import java.util.stream.Stream;
 
 public interface ICluster<I extends IInstance> extends AutoCloseable
 {
+    public static final String PROPERTY_PREFIX = "cassandra.test";
+
     void startup();
 
     I bootstrap(IInstanceConfig config);
@@ -89,16 +91,15 @@ public interface ICluster<I extends IInstance> extends AutoCloseable
         {
             File root = Files.createTempDirectory("in-jvm-dtest").toFile();
             root.deleteOnExit();
-            String testConfPath = "test/conf/logback-dtest.xml";
-            Path logConfPath = Paths.get(root.getPath(), "/logback-dtest.xml");
-
+            String logConfigPropertyName = System.getProperty(PROPERTY_PREFIX + ".logConfigProperty", "logback.configurationFile");
+            Path testConfPath = Paths.get(System.getProperty(PROPERTY_PREFIX + ".logConfigPath", "test/conf/logback-dtest.xml"));
+            Path logConfPath = Paths.get(root.getPath(), testConfPath.getFileName().toString());
             if (!logConfPath.toFile().exists())
             {
-                Files.copy(new File(testConfPath).toPath(),
-                           logConfPath);
+                Files.copy(testConfPath, logConfPath);
             }
 
-            System.setProperty("logback.configurationFile", "file://" + logConfPath);
+            System.setProperty(logConfigPropertyName, "file://" + logConfPath);
         }
         catch (IOException e)
         {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org