blob: b39e58a707d7c8b70a6a0efcb6cba291fd31b488 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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 at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless 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
~ limitations under the License.
-->
<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>
<parent>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>3.0.0-alpha1</version>
</parent>
<artifactId>log4j-layout-template-json-test</artifactId>
<name>Tests for the JSON Template Layout of Apache Log4j</name>
<properties>
<log4jParentDir>${basedir}/..</log4jParentDir>
<docLabel>Tests for the JSON Template Layout of Apache Log4j</docLabel>
<projectDir>/log4j-layout-template-json-test</projectDir>
<module.name>org.apache.logging.log4j.layout.template.json.test</module.name>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
</dependency>
<!-- needed for `MessageResolverTest#log4j1_logger_calls_should_use_fallbackKey` -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core-test</artifactId>
<scope>test</scope>
</dependency>
<!-- needed for `JsonLayoutTest` -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.java-allocation-instrumenter</groupId>
<artifactId>java-allocation-instrumenter</artifactId>
<scope>test</scope>
</dependency>
<!-- needed for `RecyclerFactoriesTest` -->
<dependency>
<groupId>org.jctools</groupId>
<artifactId>jctools-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>co.elastic.logging</groupId>
<artifactId>log4j2-ecs-layout</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Fragment-Host>org.apache.logging.log4j.core</Fragment-Host>
<Bundle-SymbolicName>org.apache.logging.log4j.layout.template.json.test</Bundle-SymbolicName>
<Export-Package>org.apache.logging.log4j.layout.template.json.test</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<release>${maven.compiler.release}</release>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<verbose>false</verbose>
<encoding>UTF-8</encoding>
<fork>false</fork>
<meminitial>256</meminitial>
<maxmem>1024</maxmem>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<!-- Workaround to access JDK internals needed by Error Prone.
Access is restricted in JEP 396 shipped with Java 16.
For details: https://errorprone.info/docs/installation -->
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<compilerArguments>
<Xmaxwarns>10000</Xmaxwarns>
<Xlint />
</compilerArguments>
<annotationProcessorPaths>
<path>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-plugin-processor</artifactId>
<version>${project.version}</version>
</path>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${errorprone.version}</version>
</path>
</annotationProcessorPaths>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<parameters>true</parameters>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgs>
<arg>-ApluginPackage=org.apache.logging.log4j.layout.template.json</arg>
</compilerArgs>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<configuration>
<compilerArgs>
<arg>-ApluginPackage=org.apache.logging.log4j.layout.template.json.test</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<!-- Disable ITs, which are Docker-dependent, by default.
Running Docker on all expected environments (OSes, Docker-disabled CI hosts, etc.) still needs to be worked out.
Next to that, certain container images (e.g., ELK stack) require environment-specific limits (e.g., `nofile`). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
<configuration combine.self="override">
<archive>
<manifestFile>${manifestfile}</manifestFile>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Specification-Vendor>${project.organization.name}</Specification-Vendor>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Enforcing a non-UTF-8 encoding to check that the layout
indeed handles everything in UTF-8 without implicitly
relying on the system defaults. -->
<argLine>-Dfile.encoding=US-ASCII</argLine>
<systemPropertyVariables>
<!-- Enable JUnit 5 parallel execution. -->
<junit.jupiter.execution.parallel.enabled>true</junit.jupiter.execution.parallel.enabled>
<junit.jupiter.execution.parallel.mode.default>concurrent</junit.jupiter.execution.parallel.mode.default>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<verbose>all</verbose>
<startParallel>true</startParallel>
<autoCreateCustomNetworks>true</autoCreateCustomNetworks>
<images>
<image>
<alias>elasticsearch</alias>
<name>docker.elastic.co/elasticsearch/elasticsearch:8.2.2</name>
<run>
<env>
<xpack.security.enabled>false</xpack.security.enabled>
<discovery.type>single-node</discovery.type>
</env>
<memory>1000000000</memory>
<!-- 1g -->
<ports>
<port>9200:9200</port>
</ports>
<network>
<mode>custom</mode>
<name>log4j-layout-template-json-network</name>
<alias>elasticsearch</alias>
</network>
<log>
<prefix>[ES]</prefix>
<color>cyan</color>
</log>
<wait>
<log>recovered \[0\] indices into cluster_state</log>
<time>60000</time>
</wait>
</run>
</image>
<image>
<alias>logstash</alias>
<name>docker.elastic.co/logstash/logstash:8.2.2</name>
<run>
<dependsOn>
<container>elasticsearch</container>
</dependsOn>
<network>
<mode>custom</mode>
<name>log4j-layout-template-json-network</name>
<alias>logstash</alias>
</network>
<ports>
<port>12222:12222</port>
<port>12345:12345</port>
</ports>
<log>
<prefix>[LS]</prefix>
<color>green</color>
</log>
<entrypoint>
<exec>
<arg>logstash</arg>
<arg>--pipeline.batch.size</arg>
<arg>1</arg>
<arg>-e</arg>
<arg>input {
gelf {
host =&gt; "logstash"
use_tcp =&gt; true
use_udp =&gt; false
port =&gt; 12222
type =&gt; "gelf"
}
tcp {
port =&gt; 12345
codec =&gt; json
type =&gt; "tcp"
}
}
filter {
if [type] == "gelf" {
# These are GELF/Syslog logging levels as defined in RFC 3164.
# Map the integer level to its human readable format.
translate {
field =&gt; "[level]"
destination =&gt; "[levelName]"
dictionary =&gt; {
"0" =&gt; "EMERG"
"1" =&gt; "ALERT"
"2" =&gt; "CRITICAL"
"3" =&gt; "ERROR"
"4" =&gt; "WARN"
"5" =&gt; "NOTICE"
"6" =&gt; "INFO"
"7" =&gt; "DEBUG"
}
}
}
}
output {
# (Un)comment for debugging purposes
# stdout { codec =&gt; rubydebug }
elasticsearch {
hosts =&gt; ["http://elasticsearch:9200"]
index =&gt; "log4j"
}
}</arg>
</exec>
</entrypoint>
<wait>
<log>Successfully started Logstash API endpoint</log>
<time>60000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>false</skip>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>