Giter VIP home page Giter VIP logo

Comments (3)

marevol avatar marevol commented on September 28, 2024

Could you provide info to reproduce it?

from elasticsearch-cluster-runner.

bunchrt avatar bunchrt commented on September 28, 2024

`
for i in $(find . -type f | egrep -v '.idea/|.iml|.DS_Store'); do printf "\n\n ~~~[ %s ]~~~~~~~~~~ \n\n" $i; cat $i; done


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.my</groupId>
   <artifactId>my-elasticsearch-testharness</artifactId>
   <version>2.2</version>

   <properties>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

       <maven.compiler.source>1.8</maven.compiler.source>
       <maven.compiler.target>1.8</maven.compiler.target>

<!--        <elasticsearch.version>7.8.0</elasticsearch.version>-->
<!--        <embedded-es.version>7.8.0</embedded-es.version>-->
<!--        <cluster-runner.version>7.8.0.0</cluster-runner.version>-->
       <elasticsearch.version>7.16.3</elasticsearch.version>
       <embedded-es.version>7.16.3</embedded-es.version>
       <cluster-runner.version>7.16.3.0</cluster-runner.version>
       <log4j2.version>2.17.1</log4j2.version>
   </properties>

   <dependencies>
       <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <version>4.12</version>
           <exclusions>
               <exclusion>
                   <groupId>org.hamcrest</groupId>
                   <artifactId>hamcrest-core</artifactId>
               </exclusion>
           </exclusions>
       </dependency>
       <dependency>
           <groupId>org.elasticsearch.test</groupId>
           <artifactId>framework</artifactId>
           <version>${elasticsearch.version}</version>
       </dependency>
       <dependency>
           <groupId>org.codelibs</groupId>
           <artifactId>elasticsearch-cluster-runner</artifactId>
           <version>${cluster-runner.version}</version>
       </dependency>
       <dependency>
           <groupId>org.apache.logging.log4j</groupId>
           <artifactId>log4j-core</artifactId>
           <version>${log4j2.version}</version>
       </dependency>
       <dependency>
           <groupId>org.apache.logging.log4j</groupId>
           <artifactId>log4j-api</artifactId>
           <version>${log4j2.version}</version>
       </dependency>
       <dependency>
           <groupId>org.apache.logging.log4j</groupId>
           <artifactId>log4j-slf4j-impl</artifactId>
           <version>${log4j2.version}</version>
       </dependency>
   </dependencies>
   <!--  added specifically for elasticsearch-cluster-runner > 7.10.0.0 -->
   <!--  REF https://github.com/codelibs/elasticsearch-cluster-runner/tree/elasticsearch-cluster-runner-7.16.3.0 -->
   <repositories>
   	<repository>
   		<id>central</id>
   		<url>https://repo1.maven.org/maven2</url>
   		<releases>
   			<enabled>true</enabled>
   		</releases>
   		<snapshots>
   			<enabled>true</enabled>
   		</snapshots>
   	</repository>
   	<repository>
   		<id>codelibs.org</id>
   		<name>CodeLibs Repository</name>
   		<url>https://maven.codelibs.org/</url>
   	</repository>
   </repositories>
   
   <build>
       <pluginManagement>
           <plugins>
               <plugin>
                   <groupId>org.jacoco</groupId>
                   <artifactId>jacoco-maven-plugin</artifactId>
                   <version>0.8.7</version>
               </plugin>
           </plugins>
       </pluginManagement>
       <plugins>
       <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <executions>
               <execution>
                   <id>prepare-agent</id>
                   <goals>
                       <goal>prepare-agent</goal>
                   </goals>
               </execution>
               <execution>
                   <id>report</id>
                   <goals>
                       <goal>report</goal>
                   </goals>
               </execution>
           </executions>
       </plugin>
       </plugins>
   </build>
</project>


~~~[ ./src/test/resources/log4j2-test.xml ]~~~~~~~~~~ 

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
   <Appenders>
       <Console name="Console">
           <PatternLayout>
               <pattern>%d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n</pattern>
           </PatternLayout>
       </Console>
   </Appenders>
   <Loggers>
       <Root level="${env:LOG_LEVEL:-ERROR}">
           <AppenderRef ref="Console"/>
       </Root>

       <Logger name="com.my" level="${env:MY_LOG_LEVEL:-TRACE}"/>
       <Logger name="com.carrotsearch" level="OFF"/>
       <Logger name="org.elasticsearch" level="WARN"/>
   </Loggers>
</Configuration>


~~~[ ./src/test/java/com/my/harness/elasticsearch/MyTest.java ]~~~~~~~~~~ 

package com.my.harness.elasticsearch;

import com.carrotsearch.randomizedtesting.RandomizedRunner;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import junit.framework.TestSuite;
import org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner;
import org.elasticsearch.common.settings.Settings;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.IOException;

import static org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.newConfigs;

@ThreadLeakScope(ThreadLeakScope.Scope.NONE)
@RunWith(RandomizedRunner.class)
public class MyTest extends TestSuite {

   public static final Integer BASE_ES_PORT = 41091;
   public static final String CLUSTER_NAME = "my_cluster";

   ElasticsearchClusterRunner runner = new ElasticsearchClusterRunner();

   @Before
   public void before() throws IOException {
       // create runner instance
       String clusterName = CLUSTER_NAME + "_" + System.currentTimeMillis();
       ElasticsearchClusterRunner.Builder builder = new ElasticsearchClusterRunner.Builder() {

           @Override
           public void build(int i, Settings.Builder settingsBuilder) {
               settingsBuilder.put("http.cors.enabled", true);
               settingsBuilder.put("http.cors.allow-origin", "*");
//                settingsBuilder.put("node.master", true);
//                settingsBuilder.put("node.data", true);
//                settingsBuilder.put("node.ingest", true);
//                settingsBuilder.putList("discovery.seed_hosts", "127.0.0.1:41091", "127.0.0.1:41092");
               settingsBuilder.put("cluster.initial_master_nodes", "127.0.0.1");
           }
       };
       runner.setMaxHttpPort(41099);
       runner.onBuild(builder).build(newConfigs().clusterName(clusterName).numOfNode(1).baseHttpPort(BASE_ES_PORT));
   }

   @Test
   public void test() {
       System.out.println("pause");
   }

   @After
   public void after() throws IOException {
       runner.close();
       runner.clean();
   }
}

`

from elasticsearch-cluster-runner.

bunchrt avatar bunchrt commented on September 28, 2024

difference between elasticsearch-7.16.3/config/log4j.properties (1st set) and your embedded log4j.properties (2nd set), for the block that appears relevant to the stack trace above (around the context of HeaderWarningAppender)

diff <(cat -n log4j2.properties | head -78 | tail -19) <(cat -n __elasticsearch-cluster-runner-7163-log4j2.properties | head -78 | tail -19)

x-opaque line not covered in cluster-runner log4j2.props (at least in this block)
ESJsonLayout vs ECSJsonLayout (lines 64, at least in this block)
data.set vs type_name (line 65/66, at least in this block)

  60        ######## Deprecation JSON #######################
  61        appender.deprecation_rolling.type = RollingFile
  62        appender.deprecation_rolling.name = deprecation_rolling
  63        appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json
  64        appender.deprecation_rolling.layout.type = ESJsonLayout
  65        appender.deprecation_rolling.layout.type_name = deprecation.elasticsearch
  66        appender.deprecation_rolling.layout.esmessagefields=x-opaque-id,key,category,elasticsearch.elastic_product_origin ### not represented in cluster-runner log4j2.props
  67        appender.deprecation_rolling.filter.rate_limit.type = RateLimitingFilter
  68
  69        appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.json.gz
  70        appender.deprecation_rolling.policies.type = Policies
  71        appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
  72        appender.deprecation_rolling.policies.size.size = 1GB
  73        appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
  74        appender.deprecation_rolling.strategy.max = 4
  75
  76        appender.header_warning.type = HeaderWarningAppender
  77        appender.header_warning.name = header_warning
  78        #################################################


  60        ######## Deprecation JSON #######################
  61        appender.deprecation_rolling.type = RollingFile
  62        appender.deprecation_rolling.name = deprecation_rolling
  63        appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json
  64        appender.deprecation_rolling.layout.type = ECSJsonLayout  ### vs ESJsonLayout (no C)
  65        # Intentionally follows a different pattern to above
  66        appender.deprecation_rolling.layout.dataset = deprecation.elasticsearch  ### vs. type_name
  67        appender.deprecation_rolling.filter.rate_limit.type = RateLimitingFilter
  68
  69        appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.json.gz
  70        appender.deprecation_rolling.policies.type = Policies
  71        appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
  72        appender.deprecation_rolling.policies.size.size = 1GB
  73        appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
  74        appender.deprecation_rolling.strategy.max = 4
  75
  76        appender.header_warning.type = HeaderWarningAppender
  77        appender.header_warning.name = header_warning
  78        #################################################

from elasticsearch-cluster-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.