This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch LOG4J2-3502 in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 6e3e4cf2b0b9614d31e3a07d1e76cadf705d243f Author: Volkan Yazıcı <[email protected]> AuthorDate: Sun May 22 21:34:35 2022 +0200 LOG4J2-3502 Add JMPS support to JTL. --- .../log4j/core/time}/InstantFormatterTest.java | 3 +- .../logging/log4j/core/time}/InstantFormatter.java | 31 +- .../pom.xml | 87 ++---- .../layout/template/json/LogEventFixture.java | 0 .../src/site/manual/index.md | 11 +- .../src/site/site.xml | 30 +- .../log4j/layout/template/json/EcsLayoutTest.java | 0 .../log4j/layout/template/json/GcpLayoutTest.java | 0 .../log4j/layout/template/json/GelfLayoutTest.java | 0 .../log4j/layout/template/json/JacksonFixture.java | 0 .../log4j/layout/template/json/JsonLayoutTest.java | 0 .../JsonTemplateLayoutAdditionalFieldTest.java | 0 .../JsonTemplateLayoutConcurrentEncodeTest.java | 0 .../JsonTemplateLayoutNullEventDelimiterTest.java | 0 .../template/json/JsonTemplateLayoutTest.java | 0 .../log4j/layout/template/json/LogstashIT.java | 0 .../log4j/layout/template/json/TestHelpers.java | 0 .../json/ThreadLocalRecyclerNestedLoggingTest.java | 0 .../json/resolver/CaseConverterResolverTest.java | 0 .../json/resolver/CounterResolverTest.java | 0 .../json/resolver/MessageResolverTest.java | 0 .../resolver/ReadOnlyStringMapResolverTest.java | 0 .../json/resolver/TimestampResolverTest.java | 0 .../layout/template/json/util/JsonWriterTest.java | 0 .../template/json/util/RecyclerFactoriesTest.java | 0 .../json/util/StringParameterParserTest.java | 0 .../json/util/TruncatingBufferedWriterTest.java | 0 .../log4j/layout/template/json/util/UrisTest.java | 0 ...onalFieldEnrichedJsonTemplateLayoutLogging.json | 0 ...eldEnrichedJsonTemplateLayoutLogging.properties | 0 ...ionalFieldEnrichedJsonTemplateLayoutLogging.xml | 0 ...onalFieldEnrichedJsonTemplateLayoutLogging.yaml | 0 .../messageFallbackKeyUsingJsonTemplateLayout.xml | 0 ...nullEventDelimitedJsonTemplateLayoutLogging.xml | 0 ...rFactoryCustomizedJsonTemplateLayoutLogging.xml | 0 .../src/test/resources/testJsonTemplateLayout.json | 0 .../resources/threadLocalRecyclerNestedLogging.xml | 0 log4j-layout-template-json/pom.xml | 315 +-------------------- .../java/module-info.java} | 21 +- .../template/json/resolver/TimestampResolver.java | 2 +- .../src/site/manual/index.md | 10 +- log4j-layout-template-json/src/site/site.xml | 30 +- log4j-perf/pom.xml | 3 +- .../json/BlackHoleByteBufferDestination.java | 0 pom.xml | 1 + 45 files changed, 106 insertions(+), 438 deletions(-) diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatterTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/InstantFormatterTest.java similarity index 95% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatterTest.java rename to log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/InstantFormatterTest.java index bc1fd42269..0f4b73de9e 100644 --- a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatterTest.java +++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/time/InstantFormatterTest.java @@ -14,9 +14,8 @@ * See the license for the specific language governing permissions and * limitations under the license. */ -package org.apache.logging.log4j.layout.template.json.util; +package org.apache.logging.log4j.core.time; -import org.apache.logging.log4j.core.time.MutableInstant; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/InstantFormatter.java similarity index 92% rename from log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatter.java rename to log4j-core/src/main/java/org/apache/logging/log4j/core/time/InstantFormatter.java index af14929151..cefc742352 100644 --- a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/InstantFormatter.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/InstantFormatter.java @@ -14,10 +14,8 @@ * See the license for the specific language governing permissions and * limitations under the license. */ -package org.apache.logging.log4j.layout.template.json.util; +package org.apache.logging.log4j.core.time; -import org.apache.logging.log4j.core.time.Instant; -import org.apache.logging.log4j.core.time.MutableInstant; import org.apache.logging.log4j.core.time.internal.format.FastDateFormat; import org.apache.logging.log4j.core.time.internal.format.FixedDateFormat; import org.apache.logging.log4j.util.Strings; @@ -30,13 +28,11 @@ import java.util.Objects; import java.util.TimeZone; /** - * A composite {@link Instant} formatter trying to employ either - * {@link FixedDateFormat}, {@link FastDateFormat}, or {@link DateTimeFormatter} - * in the given order due to performance reasons. + * A composite {@link Instant} formatter trying to employ either {@link FixedDateFormat}, {@link FastDateFormat}, or {@link DateTimeFormatter} in the given order due to performance reasons. * <p> - * Note that {@link FixedDateFormat} and {@link FastDateFormat} only support - * millisecond precision. If the pattern asks for a higher precision, - * {@link DateTimeFormatter} will be employed, which is significantly slower. + * Note that {@code FixedDateFormat} and {@code FastDateFormat} only support millisecond precision. + * If the pattern asks for a higher precision, {@code DateTimeFormatter} will be employed, which is significantly slower. + * </p> */ public final class InstantFormatter { @@ -77,13 +73,11 @@ public final class InstantFormatter { } /** - * Checks if the given {@link Instant}s are equal from the point of view of - * the employed formatter. + * Checks if the given {@link Instant}s are equal from the point of view of the employed formatter. * <p> - * This method should be preferred over {@link Instant#equals(Object)}. For - * instance, {@link FixedDateFormat} and {@link FastDateFormat} discard - * nanoseconds, hence, from their point of view, two different - * {@link Instant}s are equal if they match up to millisecond precision. + * This method should be preferred over {@link Instant#equals(Object)}. + * For instance, {@link FixedDateFormat} and {@link FastDateFormat} discard nanoseconds, hence, from their point of view, two different {@code Instant}s are equal if they match up to millisecond precision. + * </p> */ public boolean isInstantMatching(final Instant instant1, final Instant instant2) { return formatter.isInstantMatching(instant1, instant2); @@ -341,8 +335,7 @@ public final class InstantFormatter { } /** - * Checks if the provided formatter output matches with the one generated by - * {@link DateTimeFormatter}. + * Checks if the provided formatter output matches with the one generated by {@link DateTimeFormatter}. */ private static boolean patternSupported( final String pattern, @@ -357,9 +350,7 @@ public final class InstantFormatter { instant.initFromEpochSecond( // 2021-05-17 21:41:10 1621280470, - // Using the highest nanosecond precision possible to - // differentiate formatters only supporting millisecond - // precision. + // Using the highest nanosecond precision possible to differentiate formatters only supporting millisecond precision. 123_456_789); final String expectedFormat = javaFormatter.format(instant); final StringBuilder stringBuilder = new StringBuilder(); diff --git a/log4j-layout-template-json/pom.xml b/log4j-layout-template-json-test/pom.xml similarity index 87% copy from log4j-layout-template-json/pom.xml copy to log4j-layout-template-json-test/pom.xml index 6507df8f6b..26930c98e8 100644 --- a/log4j-layout-template-json/pom.xml +++ b/log4j-layout-template-json-test/pom.xml @@ -15,7 +15,9 @@ ~ 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"> +<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> @@ -25,17 +27,14 @@ <version>3.0.0-SNAPSHOT</version> </parent> - <artifactId>log4j-layout-template-json</artifactId> - <name>Apache Log4j Layout for JSON template</name> - <description> - Apache Log4j Layout for JSON template. - </description> + <artifactId>log4j-layout-template-json-test</artifactId> + <name>Tests for the JSON Template Layout of Apache Log4j</name> <properties> <log4jParentDir>${basedir}/..</log4jParentDir> - <docLabel>Log4j Layout for JSON Template Documentation</docLabel> - <projectDir>/log4j-layout-template-json</projectDir> - <module.name>org.apache.logging.log4j.layout.template.json</module.name> + <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> <maven.doap.skip>true</maven.doap.skip> </properties> @@ -43,7 +42,7 @@ <dependency> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> + <artifactId>log4j-layout-template-json</artifactId> </dependency> <dependency> @@ -53,6 +52,14 @@ <scope>test</scope> </dependency> + <!-- needed for `RecyclerFactoriesTest` --> + <dependency> + <groupId>org.jctools</groupId> + <artifactId>jctools-core</artifactId> + <scope>test</scope> + </dependency> + + <!-- needed for `JsonLayoutTest` --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-layout-jackson-json</artifactId> @@ -60,6 +67,7 @@ <scope>test</scope> </dependency> + <!-- needed for `MessageResolverTest#log4j1_logger_calls_should_use_fallbackKey` --> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-1.2-api</artifactId> @@ -67,12 +75,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.jctools</groupId> - <artifactId>jctools-core</artifactId> - <optional>true</optional> - </dependency> - <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> @@ -125,6 +127,7 @@ <build> <plugins> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -143,10 +146,9 @@ <compilerArgs> <arg>-XDcompilePolicy=simple</arg> <arg>-Xplugin:ErrorProne</arg> - <!-- - https://errorprone.info/docs/installation - in Java 16+, https://openjdk.java.net/jeps/396 encapsulates internals that errorprone needs - --> + <!-- 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> @@ -160,7 +162,7 @@ </compilerArgs> <compilerArguments> <Xmaxwarns>10000</Xmaxwarns> - <Xlint /> + <Xlint/> </compilerArguments> <annotationProcessorPaths> <path> @@ -194,28 +196,17 @@ </compilerArgs> </configuration> </execution> - <!--<execution> - <id>compile-module-info</id> - <goals> - <goal>compile</goal> - </goals> - <phase>prepare-package</phase> - <configuration> - <compileSourceRoots> - <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot> - </compileSourceRoots> - </configuration> - </execution>--> </executions> </plugin> + <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</Bundle-SymbolicName> - <Export-Package>org.apache.logging.log4j.layout.template.json</Export-Package> + <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> @@ -247,28 +238,6 @@ </archive> </configuration> </execution> - <execution> - <id>default</id> - <goals> - <goal>test-jar</goal> - </goals> - <configuration> - <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> - </manifestEntries> - </archive> - </configuration> - </execution> </executions> </plugin> @@ -469,6 +438,7 @@ </images> </configuration> </plugin> + </plugins> </build> </profile> @@ -499,7 +469,6 @@ <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.plugin.version}</version> <configuration> - <!--<propertiesLocation>${vfs.parent.dir}/checkstyle.properties</propertiesLocation> --> <configLocation>${log4jParentDir}/checkstyle.xml</configLocation> <suppressionsLocation>${log4jParentDir}/checkstyle-suppressions.xml</suppressionsLocation> <enableRulesSummary>false</enableRulesSummary> @@ -516,7 +485,7 @@ <bottom><![CDATA[<p align="center">Copyright © {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved.<br /> Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p>]]></bottom> - <!-- module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating project --> + <!-- Module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating project: --> <detectOfflineLinks>false</detectOfflineLinks> <linksource>true</linksource> </configuration> diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/LogEventFixture.java b/log4j-layout-template-json-test/src/main/java/org/apache/logging/log4j/layout/template/json/LogEventFixture.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/LogEventFixture.java rename to log4j-layout-template-json-test/src/main/java/org/apache/logging/log4j/layout/template/json/LogEventFixture.java diff --git a/log4j-layout-template-json/src/site/manual/index.md b/log4j-layout-template-json-test/src/site/manual/index.md similarity index 73% copy from log4j-layout-template-json/src/site/manual/index.md copy to log4j-layout-template-json-test/src/site/manual/index.md index b8cb6e38da..7bd83d9d37 100644 --- a/log4j-layout-template-json/src/site/manual/index.md +++ b/log4j-layout-template-json-test/src/site/manual/index.md @@ -16,17 +16,16 @@ limitations under the License. --> -# Apache Log4j JSON Template Layout module +# Apache Log4j JSON Template Layout module tests -This module provides a customizable and efficient JSON layout. +This module provides tests and test utilities for [the JSON Template Layout](/manual/json-template-layout.html). ## Requirements -This module was introduced in Log4j 3.0.0 and requires Jackson. +This module was introduced in Log4j 3.0.0. Some features may require optional [dependencies](../runtime-dependencies.html). These dependencies are specified in the documentation for those features. -Some Log4j features require external dependencies. See the -[Dependency Tree](dependencies.html#Dependency_Tree) for the exact list of JAR -files needed for these features. +Some Log4j features require external dependencies. +See the [Dependency Tree](dependencies.html#Dependency_Tree) for the exact list of JAR files needed for these features. diff --git a/log4j-layout-template-json/src/site/site.xml b/log4j-layout-template-json-test/src/site/site.xml similarity index 73% copy from log4j-layout-template-json/src/site/site.xml copy to log4j-layout-template-json-test/src/site/site.xml index 962392e838..b837fba98e 100644 --- a/log4j-layout-template-json/src/site/site.xml +++ b/log4j-layout-template-json-test/src/site/site.xml @@ -22,7 +22,7 @@ <body> <links> - <item name="Apache" href="http://www.apache.org/" /> + <item name="Apache" href="http://www.apache.org/"/> <item name="Logging Services" href="http://logging.apache.org/"/> <item name="Log4j" href="../index.html"/> </links> @@ -30,24 +30,24 @@ <!-- Component-specific reports --> <menu ref="reports"/> - <!-- Overall Project Info --> + <!-- Overall Project Info --> <menu name="Log4j Project Information" img="icon-info-sign"> - <item name="Dependencies" href="../dependencies.html" /> - <item name="Dependency Convergence" href="../dependency-convergence.html" /> - <item name="Dependency Management" href="../dependency-management.html" /> - <item name="Project Team" href="../team-list.html" /> - <item name="Mailing Lists" href="../mail-lists.html" /> - <item name="Issue Tracking" href="../issue-tracking.html" /> - <item name="Project License" href="../license.html" /> - <item name="Source Repository" href="../source-repository.html" /> - <item name="Project Summary" href="../project-summary.html" /> + <item name="Dependencies" href="../dependencies.html"/> + <item name="Dependency Convergence" href="../dependency-convergence.html"/> + <item name="Dependency Management" href="../dependency-management.html"/> + <item name="Project Team" href="../team-list.html"/> + <item name="Mailing Lists" href="../mail-lists.html"/> + <item name="Issue Tracking" href="../issue-tracking.html"/> + <item name="Project License" href="../license.html"/> + <item name="Source Repository" href="../source-repository.html"/> + <item name="Project Summary" href="../project-summary.html"/> </menu> <menu name="Log4j Project Reports" img="icon-cog"> - <item name="Changes Report" href="../changes-report.html" /> - <item name="JIRA Report" href="../jira-report.html" /> - <item name="Surefire Report" href="../surefire-report.html" /> - <item name="RAT Report" href="../rat-report.html" /> + <item name="Changes Report" href="../changes-report.html"/> + <item name="JIRA Report" href="../jira-report.html"/> + <item name="Surefire Report" href="../surefire-report.html"/> + <item name="RAT Report" href="../rat-report.html"/> </menu> </body> diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/EcsLayoutTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/EcsLayoutTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/EcsLayoutTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/EcsLayoutTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/GcpLayoutTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/GcpLayoutTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/GcpLayoutTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/GcpLayoutTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/GelfLayoutTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/GelfLayoutTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/GelfLayoutTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/GelfLayoutTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java similarity index 100% copy from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java copy to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonLayoutTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonLayoutTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonLayoutTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonLayoutTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutAdditionalFieldTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutConcurrentEncodeTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutNullEventDelimiterTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutNullEventDelimiterTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutNullEventDelimiterTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutNullEventDelimiterTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/JsonTemplateLayoutTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/LogstashIT.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/LogstashIT.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/LogstashIT.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/LogstashIT.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/TestHelpers.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/ThreadLocalRecyclerNestedLoggingTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/ThreadLocalRecyclerNestedLoggingTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/ThreadLocalRecyclerNestedLoggingTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/ThreadLocalRecyclerNestedLoggingTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolverTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolverTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolverTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CaseConverterResolverTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/CounterResolverTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/MessageResolverTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/ReadOnlyStringMapResolverTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/ReadOnlyStringMapResolverTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/ReadOnlyStringMapResolverTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/ReadOnlyStringMapResolverTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolverTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolverTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolverTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolverTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/JsonWriterTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/JsonWriterTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/JsonWriterTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/JsonWriterTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/RecyclerFactoriesTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/RecyclerFactoriesTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/RecyclerFactoriesTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/RecyclerFactoriesTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/StringParameterParserTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/StringParameterParserTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/StringParameterParserTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/StringParameterParserTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/TruncatingBufferedWriterTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/TruncatingBufferedWriterTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/TruncatingBufferedWriterTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/TruncatingBufferedWriterTest.java diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/UrisTest.java b/log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/UrisTest.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/util/UrisTest.java rename to log4j-layout-template-json-test/src/test/java/org/apache/logging/log4j/layout/template/json/util/UrisTest.java diff --git a/log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.json b/log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.json similarity index 100% rename from log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.json rename to log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.json diff --git a/log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.properties b/log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.properties similarity index 100% rename from log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.properties rename to log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.properties diff --git a/log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.xml b/log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.xml similarity index 100% rename from log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.xml rename to log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.xml diff --git a/log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.yaml b/log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.yaml similarity index 100% rename from log4j-layout-template-json/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.yaml rename to log4j-layout-template-json-test/src/test/resources/additionalFieldEnrichedJsonTemplateLayoutLogging.yaml diff --git a/log4j-layout-template-json/src/test/resources/messageFallbackKeyUsingJsonTemplateLayout.xml b/log4j-layout-template-json-test/src/test/resources/messageFallbackKeyUsingJsonTemplateLayout.xml similarity index 100% rename from log4j-layout-template-json/src/test/resources/messageFallbackKeyUsingJsonTemplateLayout.xml rename to log4j-layout-template-json-test/src/test/resources/messageFallbackKeyUsingJsonTemplateLayout.xml diff --git a/log4j-layout-template-json/src/test/resources/nullEventDelimitedJsonTemplateLayoutLogging.xml b/log4j-layout-template-json-test/src/test/resources/nullEventDelimitedJsonTemplateLayoutLogging.xml similarity index 100% rename from log4j-layout-template-json/src/test/resources/nullEventDelimitedJsonTemplateLayoutLogging.xml rename to log4j-layout-template-json-test/src/test/resources/nullEventDelimitedJsonTemplateLayoutLogging.xml diff --git a/log4j-layout-template-json/src/test/resources/recyclerFactoryCustomizedJsonTemplateLayoutLogging.xml b/log4j-layout-template-json-test/src/test/resources/recyclerFactoryCustomizedJsonTemplateLayoutLogging.xml similarity index 100% rename from log4j-layout-template-json/src/test/resources/recyclerFactoryCustomizedJsonTemplateLayoutLogging.xml rename to log4j-layout-template-json-test/src/test/resources/recyclerFactoryCustomizedJsonTemplateLayoutLogging.xml diff --git a/log4j-layout-template-json/src/test/resources/testJsonTemplateLayout.json b/log4j-layout-template-json-test/src/test/resources/testJsonTemplateLayout.json similarity index 100% rename from log4j-layout-template-json/src/test/resources/testJsonTemplateLayout.json rename to log4j-layout-template-json-test/src/test/resources/testJsonTemplateLayout.json diff --git a/log4j-layout-template-json/src/test/resources/threadLocalRecyclerNestedLogging.xml b/log4j-layout-template-json-test/src/test/resources/threadLocalRecyclerNestedLogging.xml similarity index 100% rename from log4j-layout-template-json/src/test/resources/threadLocalRecyclerNestedLogging.xml rename to log4j-layout-template-json-test/src/test/resources/threadLocalRecyclerNestedLogging.xml diff --git a/log4j-layout-template-json/pom.xml b/log4j-layout-template-json/pom.xml index 6507df8f6b..e254c09900 100644 --- a/log4j-layout-template-json/pom.xml +++ b/log4j-layout-template-json/pom.xml @@ -26,9 +26,10 @@ </parent> <artifactId>log4j-layout-template-json</artifactId> - <name>Apache Log4j Layout for JSON template</name> + <name>Apache Log4j layout for templated JSON encoding</name> <description> - Apache Log4j Layout for JSON template. + JSON Template Layout is a customizable, efficient, and garbage-free JSON generating Apache Log4j layout. + It encodes log events according to the structure described by the JSON template provided. </description> <properties> @@ -46,85 +47,17 @@ <artifactId>log4j-core</artifactId> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core-test</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-layout-jackson-json</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-1.2-api</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.jctools</groupId> <artifactId>jctools-core</artifactId> <optional>true</optional> </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>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>co.elastic.logging</groupId> - <artifactId>log4j2-ecs-layout</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>com.google.code.java-allocation-instrumenter</groupId> - <artifactId>java-allocation-instrumenter</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.elasticsearch.client</groupId> - <artifactId>elasticsearch-rest-high-level-client</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility</artifactId> - <scope>test</scope> - </dependency> - </dependencies> <build> <plugins> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -143,10 +76,9 @@ <compilerArgs> <arg>-XDcompilePolicy=simple</arg> <arg>-Xplugin:ErrorProne</arg> - <!-- - https://errorprone.info/docs/installation - in Java 16+, https://openjdk.java.net/jeps/396 encapsulates internals that errorprone needs - --> + <!-- 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> @@ -186,28 +118,9 @@ </compilerArgs> </configuration> </execution> - <execution> - <id>default-testCompile</id> - <configuration> - <compilerArgs> - <arg>-ApluginPackage=org.apache.logging.log4j.layout.template.json.test</arg> - </compilerArgs> - </configuration> - </execution> - <!--<execution> - <id>compile-module-info</id> - <goals> - <goal>compile</goal> - </goals> - <phase>prepare-package</phase> - <configuration> - <compileSourceRoots> - <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot> - </compileSourceRoots> - </configuration> - </execution>--> </executions> </plugin> + <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> @@ -247,59 +160,22 @@ </archive> </configuration> </execution> - <execution> - <id>default</id> - <goals> - <goal>test-jar</goal> - </goals> - <configuration> - <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> - </manifestEntries> - </archive> - </configuration> - </execution> </executions> </plugin> + <!-- Disable Surefire since tests go to the `-test` module. --> <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> + <skip>true</skip> </configuration> </plugin> - <!-- Disable ITs, which are Docker-dependent, by default. --> + <!-- Disable Failsafe since tests go to the `-test` module. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> <configuration> <skip>true</skip> </configuration> @@ -308,172 +184,6 @@ </plugins> </build> - <profiles> - <profile> - <id>docker</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <build> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <includes> - <include>**/*IT.java</include> - </includes> - </configuration> - </plugin> - - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <executions> - <execution> - <id>start</id> - <phase>pre-integration-test</phase> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop</id> - <phase>post-integration-test</phase> - <goals> - <goal>stop</goal> - </goals> - </execution> - </executions> - <configuration> - <verbose>all</verbose> - <startParallel>true</startParallel> - <autoCreateCustomNetworks>true</autoCreateCustomNetworks> - <images> - <image> - <alias>elasticsearch</alias> - <name>elasticsearch:${elastic.version}</name> - <run> - <env> - <discovery.type>single-node</discovery.type> - </env> - <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>logstash:${elastic.version}</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> - <![CDATA[ - input { - gelf { - host => "logstash" - use_tcp => true - use_udp => false - port => 12222 - type => "gelf" - } - tcp { - port => 12345 - codec => json - type => "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 => "[level]" - destination => "[levelName]" - dictionary => { - "0" => "EMERG" - "1" => "ALERT" - "2" => "CRITICAL" - "3" => "ERROR" - "4" => "WARN" - "5" => "NOTICE" - "6" => "INFO" - "7" => "DEBUG" - } - } - } - } - - output { - # (Un)comment for debugging purposes - # stdout { codec => rubydebug } - elasticsearch { - hosts => ["http://elasticsearch:9200"] - index => "log4j" - } - } - ]]> - </arg> - </exec> - </entrypoint> - <wait> - <log>Successfully started Logstash API endpoint</log> - <time>60000</time> - </wait> - </run> - </image> - </images> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <reporting> <plugins> @@ -499,7 +209,6 @@ <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.plugin.version}</version> <configuration> - <!--<propertiesLocation>${vfs.parent.dir}/checkstyle.properties</propertiesLocation> --> <configLocation>${log4jParentDir}/checkstyle.xml</configLocation> <suppressionsLocation>${log4jParentDir}/checkstyle-suppressions.xml</suppressionsLocation> <enableRulesSummary>false</enableRulesSummary> @@ -516,7 +225,7 @@ <bottom><![CDATA[<p align="center">Copyright © {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved.<br /> Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.</p>]]></bottom> - <!-- module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating project --> + <!-- Module link generation is completely broken in the javadoc plugin for a multi-module non-aggregating project: --> <detectOfflineLinks>false</detectOfflineLinks> <linksource>true</linksource> </configuration> diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java b/log4j-layout-template-json/src/main/java/module-info.java similarity index 57% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java rename to log4j-layout-template-json/src/main/java/module-info.java index aaf5c4f85a..e87682062b 100644 --- a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/JacksonFixture.java +++ b/log4j-layout-template-json/src/main/java/module-info.java @@ -14,18 +14,19 @@ * See the license for the specific language governing permissions and * limitations under the license. */ -package org.apache.logging.log4j.layout.template.json; +module org.apache.logging.log4j.layout.template.json { -import com.fasterxml.jackson.databind.ObjectMapper; + exports org.apache.logging.log4j.layout.template.json; + exports org.apache.logging.log4j.layout.template.json.resolver; + exports org.apache.logging.log4j.layout.template.json.util; -public final class JacksonFixture { + opens org.apache.logging.log4j.layout.template.json; + opens org.apache.logging.log4j.layout.template.json.resolver; + opens org.apache.logging.log4j.layout.template.json.util; - private JacksonFixture() {} - - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - - public static ObjectMapper getObjectMapper() { - return OBJECT_MAPPER; - } + requires org.apache.logging.log4j; + requires org.apache.logging.log4j.plugins; + requires org.apache.logging.log4j.core; + requires org.jctools.core; } diff --git a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolver.java b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolver.java index a2f1132a89..148c7849e3 100644 --- a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolver.java +++ b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TimestampResolver.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.time.Instant; import org.apache.logging.log4j.core.time.MutableInstant; import org.apache.logging.log4j.layout.template.json.JsonTemplateLayoutDefaults; -import org.apache.logging.log4j.layout.template.json.util.InstantFormatter; +import org.apache.logging.log4j.core.time.InstantFormatter; import org.apache.logging.log4j.layout.template.json.util.JsonWriter; import java.util.Locale; diff --git a/log4j-layout-template-json/src/site/manual/index.md b/log4j-layout-template-json/src/site/manual/index.md index b8cb6e38da..c79769640d 100644 --- a/log4j-layout-template-json/src/site/manual/index.md +++ b/log4j-layout-template-json/src/site/manual/index.md @@ -18,15 +18,15 @@ # Apache Log4j JSON Template Layout module -This module provides a customizable and efficient JSON layout. +This module provides a customizable, efficient, and garbage-free JSON generating Apache Log4j layout. +It encodes log events according to the structure described by the JSON template provided. ## Requirements -This module was introduced in Log4j 3.0.0 and requires Jackson. +This module was introduced in Log4j 2.14.0. Some features may require optional [dependencies](../runtime-dependencies.html). These dependencies are specified in the documentation for those features. -Some Log4j features require external dependencies. See the -[Dependency Tree](dependencies.html#Dependency_Tree) for the exact list of JAR -files needed for these features. +Some Log4j features require external dependencies. +See the [Dependency Tree](dependencies.html#Dependency_Tree) for the exact list of JAR files needed for these features. diff --git a/log4j-layout-template-json/src/site/site.xml b/log4j-layout-template-json/src/site/site.xml index 962392e838..b837fba98e 100644 --- a/log4j-layout-template-json/src/site/site.xml +++ b/log4j-layout-template-json/src/site/site.xml @@ -22,7 +22,7 @@ <body> <links> - <item name="Apache" href="http://www.apache.org/" /> + <item name="Apache" href="http://www.apache.org/"/> <item name="Logging Services" href="http://logging.apache.org/"/> <item name="Log4j" href="../index.html"/> </links> @@ -30,24 +30,24 @@ <!-- Component-specific reports --> <menu ref="reports"/> - <!-- Overall Project Info --> + <!-- Overall Project Info --> <menu name="Log4j Project Information" img="icon-info-sign"> - <item name="Dependencies" href="../dependencies.html" /> - <item name="Dependency Convergence" href="../dependency-convergence.html" /> - <item name="Dependency Management" href="../dependency-management.html" /> - <item name="Project Team" href="../team-list.html" /> - <item name="Mailing Lists" href="../mail-lists.html" /> - <item name="Issue Tracking" href="../issue-tracking.html" /> - <item name="Project License" href="../license.html" /> - <item name="Source Repository" href="../source-repository.html" /> - <item name="Project Summary" href="../project-summary.html" /> + <item name="Dependencies" href="../dependencies.html"/> + <item name="Dependency Convergence" href="../dependency-convergence.html"/> + <item name="Dependency Management" href="../dependency-management.html"/> + <item name="Project Team" href="../team-list.html"/> + <item name="Mailing Lists" href="../mail-lists.html"/> + <item name="Issue Tracking" href="../issue-tracking.html"/> + <item name="Project License" href="../license.html"/> + <item name="Source Repository" href="../source-repository.html"/> + <item name="Project Summary" href="../project-summary.html"/> </menu> <menu name="Log4j Project Reports" img="icon-cog"> - <item name="Changes Report" href="../changes-report.html" /> - <item name="JIRA Report" href="../jira-report.html" /> - <item name="Surefire Report" href="../surefire-report.html" /> - <item name="RAT Report" href="../rat-report.html" /> + <item name="Changes Report" href="../changes-report.html"/> + <item name="JIRA Report" href="../jira-report.html"/> + <item name="Surefire Report" href="../surefire-report.html"/> + <item name="RAT Report" href="../rat-report.html"/> </menu> </body> diff --git a/log4j-perf/pom.xml b/log4j-perf/pom.xml index 79f242e8ae..a66fcb8dbd 100644 --- a/log4j-perf/pom.xml +++ b/log4j-perf/pom.xml @@ -88,9 +88,8 @@ </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-layout-template-json</artifactId> + <artifactId>log4j-layout-template-json-test</artifactId> <version>${project.version}</version> - <type>test-jar</type> </dependency> <dependency> <groupId>org.slf4j</groupId> diff --git a/log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/BlackHoleByteBufferDestination.java b/log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/BlackHoleByteBufferDestination.java similarity index 100% rename from log4j-layout-template-json/src/test/java/org/apache/logging/log4j/layout/template/json/BlackHoleByteBufferDestination.java rename to log4j-perf/src/main/java/org/apache/logging/log4j/layout/template/json/BlackHoleByteBufferDestination.java diff --git a/pom.xml b/pom.xml index 56af379def..b27f2ad960 100644 --- a/pom.xml +++ b/pom.xml @@ -1776,6 +1776,7 @@ <module>log4j-layout-jackson-xml</module> <module>log4j-layout-jackson-yaml</module> <module>log4j-layout-template-json</module> + <module>log4j-layout-template-json-test</module> <module>log4j-csv</module> <!-- Lookups --> <module>log4j-jndi</module>
