You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/11/22 12:10:57 UTC
(logging-log4j2) 08/13: Remove `log4j-layout-jackson-yaml`
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch module-deletion
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 5b8aa2e4546d5c70395db3f7a4742ad98d2e2042
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Tue Nov 21 20:20:53 2023 +0100
Remove `log4j-layout-jackson-yaml`
---
log4j-distribution/pom.xml | 12 -
log4j-layout-jackson-yaml/pom.xml | 106 ------
.../log4j/jackson/yaml/Log4jYamlModule.java | 60 ---
.../log4j/jackson/yaml/Log4jYamlObjectMapper.java | 52 ---
.../jackson/yaml/YamlSetupContextInitializer.java | 65 ----
.../log4j/jackson/yaml/layout/YamlConstants.java | 35 --
.../jackson/yaml/layout/YamlJacksonFactory.java | 76 ----
.../log4j/jackson/yaml/layout/YamlLayout.java | 239 ------------
.../log4j/jackson/yaml/layout/package-info.java | 22 --
.../logging/log4j/jackson/yaml/package-info.java | 22 --
.../jackson/yaml/parser/YamlLogEventParser.java | 31 --
.../log4j/jackson/yaml/parser/package-info.java | 22 --
.../log4j/jackson/yaml/LevelMixInYamlTest.java | 28 --
.../log4j/jackson/yaml/MarkerMixInYamlTest.java | 28 --
.../yaml/StackTraceElementYamlMixInTest.java | 75 ----
.../ConcurrentLoggingWithYamlLayoutTest.java | 103 ------
.../log4j/jackson/yaml/layout/YamlLayoutTest.java | 403 ---------------------
.../yaml/parser/YamlLogEventParserTest.java | 125 -------
.../src/test/resources/log4j2-yaml-layout.xml | 30 --
pom.xml | 7 -
src/site/asciidoc/manual/layouts.adoc | 112 ------
src/site/asciidoc/runtime-dependencies.adoc | 3 -
src/site/markdown/log4j-layout-jackson-yaml.md | 33 --
src/site/site.xml | 1 -
24 files changed, 1690 deletions(-)
diff --git a/log4j-distribution/pom.xml b/log4j-distribution/pom.xml
index 807160dd4b..6406e6434b 100644
--- a/log4j-distribution/pom.xml
+++ b/log4j-distribution/pom.xml
@@ -321,18 +321,6 @@
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
- <!-- log4j-layout-jackson-yaml -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson-yaml</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson-yaml</artifactId>
- <version>${project.version}</version>
- <classifier>sources</classifier>
- </dependency>
<!-- log4j-layout-template-json -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
diff --git a/log4j-layout-jackson-yaml/pom.xml b/log4j-layout-jackson-yaml/pom.xml
deleted file mode 100644
index 594f730340..0000000000
--- a/log4j-layout-jackson-yaml/pom.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?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>${revision}</version>
- <relativePath>../log4j-parent</relativePath>
- </parent>
-
- <artifactId>log4j-layout-jackson-yaml</artifactId>
- <name>Apache Log4j Layout for Jackson YAML</name>
- <description>Apache Log4j Layout for Jackson YAML.</description>
- <properties>
- <log4jParentDir>${basedir}/..</log4jParentDir>
- <docLabel>Log4j Layout for Jackson YAML Documentation</docLabel>
- <projectDir>/log4j-layout-yaml</projectDir>
-
- <!--
- ~ OSGi and JPMS options
- -->
- <bnd-extra-module-options>
- <!-- BND 6.x does not recognize multi-release JARs. Remove when 7.x is published -->
- com.fasterxml.jackson.core;substitute="jackson-core",
- com.fasterxml.jackson.databind;substitute="jackson-databind",
- com.fasterxml.jackson.dataformat.yaml;substitute="jackson-dataformat-yaml",
- <!-- The module name of `log4j-layout-jackson` is not recognized in some Maven runs -->
- org.apache.logging.log4j.jackson;substitute="log4j-layout-jackson"
- </bnd-extra-module-options>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <annotationProcessorPaths combine.children="append">
- <path>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-plugin-processor</artifactId>
- <version>${project.version}</version>
- </path>
- </annotationProcessorPaths>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlModule.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlModule.java
deleted file mode 100644
index 2e843d9f08..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlModule.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import org.apache.logging.log4j.jackson.SetupContextInitializer;
-import org.apache.logging.log4j.jackson.SimpleModuleInitializer;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-final class Log4jYamlModule extends SimpleModule {
-
- private static final long serialVersionUID = 1L;
- private final boolean encodeThreadContextAsList;
- private final boolean includeStacktrace;
- private final boolean stacktraceAsString;
-
- Log4jYamlModule(
- final boolean encodeThreadContextAsList,
- final boolean includeStacktrace,
- final boolean stacktraceAsString) {
- super(Log4jYamlModule.class.getName(), new Version(2, 0, 0, null, null, null));
- this.encodeThreadContextAsList = encodeThreadContextAsList;
- this.includeStacktrace = includeStacktrace;
- this.stacktraceAsString = stacktraceAsString;
- // MUST call initialize() here.
- // Calling this from setupModule is too late!
- // noinspection ThisEscapedInObjectConstruction
- new SimpleModuleInitializer().initialize(this, false);
- }
-
- @Override
- public void setupModule(final SetupContext context) {
- // MUST call super here.
- super.setupModule(context);
- if (encodeThreadContextAsList) {
- new SetupContextInitializer().setupModule(context, includeStacktrace, stacktraceAsString);
- } else {
- new YamlSetupContextInitializer().setupModule(context, includeStacktrace, stacktraceAsString);
- }
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlObjectMapper.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlObjectMapper.java
deleted file mode 100644
index 199ebc90b1..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/Log4jYamlObjectMapper.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
-import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
-
-/**
- * A Jackson {@link ObjectMapper} initialized for Log4j.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class Log4jYamlObjectMapper extends YAMLMapper {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a new instance using the {@link Log4jYamlModule}.
- */
- public Log4jYamlObjectMapper() {
- this(false, true, false);
- }
-
- /**
- * Create a new instance using the {@link Log4jYamlModule}.
- */
- public Log4jYamlObjectMapper(
- final boolean encodeThreadContextAsList,
- final boolean includeStacktrace,
- final boolean stacktraceAsString) {
- this.registerModule(new Log4jYamlModule(encodeThreadContextAsList, includeStacktrace, stacktraceAsString));
- this.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- this.disable(YAMLGenerator.Feature.SPLIT_LINES);
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/YamlSetupContextInitializer.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/YamlSetupContextInitializer.java
deleted file mode 100644
index 4fd5075f48..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/YamlSetupContextInitializer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import com.fasterxml.jackson.databind.Module.SetupContext;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.core.time.Instant;
-import org.apache.logging.log4j.jackson.ExtendedStackTraceElementMixIn;
-import org.apache.logging.log4j.jackson.InstantMixIn;
-import org.apache.logging.log4j.jackson.LevelMixIn;
-import org.apache.logging.log4j.jackson.LogEventJsonMixIn;
-import org.apache.logging.log4j.jackson.MarkerMixIn;
-import org.apache.logging.log4j.jackson.StackTraceElementMixIn;
-import org.apache.logging.log4j.jackson.ThrowableProxyMixIn;
-import org.apache.logging.log4j.jackson.ThrowableProxyWithStacktraceAsStringMixIn;
-import org.apache.logging.log4j.jackson.ThrowableProxyWithoutStacktraceMixIn;
-
-/**
- * Used to set up {@link SetupContext} from different {@link SimpleModule}s.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-class YamlSetupContextInitializer {
-
- public void setupModule(
- final SetupContext context, final boolean includeStacktrace, final boolean stacktraceAsString) {
- // JRE classes: we cannot edit those with Jackson annotations
- context.setMixInAnnotations(StackTraceElement.class, StackTraceElementMixIn.class);
- // Log4j API classes: we do not want to edit those with Jackson annotations because the API module should not
- // depend on Jackson.
- context.setMixInAnnotations(Marker.class, MarkerMixIn.class);
- context.setMixInAnnotations(Level.class, LevelMixIn.class);
- context.setMixInAnnotations(Instant.class, InstantMixIn.class);
- context.setMixInAnnotations(LogEvent.class, LogEventJsonMixIn.class); // different ThreadContext handling
- // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
- context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementMixIn.class);
- context.setMixInAnnotations(
- ThrowableProxy.class,
- includeStacktrace
- ? (stacktraceAsString
- ? ThrowableProxyWithStacktraceAsStringMixIn.class
- : ThrowableProxyMixIn.class)
- : ThrowableProxyWithoutStacktraceMixIn.class);
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlConstants.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlConstants.java
deleted file mode 100644
index 5b811ae45e..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlConstants.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-public class YamlConstants {
-
- static final String EVENT = "event";
- static final String ELT_CAUSE = "cause";
- static final String ELT_CONTEXT_MAP = "contextMap";
- static final String ELT_CONTEXT_STACK = "contextStack";
- static final String ELT_MARKER = "marker";
- static final String ELT_PARENTS = "parents";
- static final String ELT_SOURCE = "source";
- static final String ELT_SUPPRESSED = "suppressed";
- static final String ELT_THROWN = "thrown";
- static final String ELT_MESSAGE = "message";
- static final String ELT_EXTENDED_STACK_TRACE = "extendedStackTrace";
- static final String ELT_NANO_TIME = "nanoTime";
- static final String ELT_INSTANT = "instant";
- static final String ELT_TIME_MILLIS = "timeMillis";
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlJacksonFactory.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlJacksonFactory.java
deleted file mode 100644
index b05270b652..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlJacksonFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-import com.fasterxml.jackson.core.PrettyPrinter;
-import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
-import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.jackson.AbstractJacksonFactory;
-import org.apache.logging.log4j.jackson.yaml.Log4jYamlObjectMapper;
-
-class YamlJacksonFactory extends AbstractJacksonFactory {
-
- public YamlJacksonFactory(final boolean includeStacktrace, final boolean stacktraceAsString) {
- super(includeStacktrace, stacktraceAsString);
- }
-
- @Override
- protected String getPropertyNameForContextMap() {
- return YamlConstants.ELT_CONTEXT_MAP;
- }
-
- @Override
- protected String getPropertyNameForTimeMillis() {
- return YamlConstants.ELT_TIME_MILLIS;
- }
-
- @Override
- protected String getPropertyNameForInstant() {
- return YamlConstants.ELT_INSTANT;
- }
-
- @Override
- protected String getPropertyNameForNanoTime() {
- return YamlConstants.ELT_NANO_TIME;
- }
-
- @Override
- protected String getPropertyNameForSource() {
- return YamlConstants.ELT_SOURCE;
- }
-
- @Override
- protected String getPropertyNameForStackTrace() {
- return YamlConstants.ELT_EXTENDED_STACK_TRACE;
- }
-
- @Override
- protected PrettyPrinter newCompactPrinter() {
- return new MinimalPrettyPrinter();
- }
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jYamlObjectMapper(false, includeStacktrace, stacktraceAsString);
- }
-
- @Override
- protected PrettyPrinter newPrettyPrinter() {
- return new DefaultPrettyPrinter();
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayout.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayout.java
deleted file mode 100644
index cbc53385bb..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayout.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.annotation.JsonUnwrapped;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.logging.log4j.core.Layout;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.config.DefaultConfiguration;
-import org.apache.logging.log4j.core.layout.PatternLayout;
-import org.apache.logging.log4j.core.util.KeyValuePair;
-import org.apache.logging.log4j.jackson.AbstractJacksonLayout;
-import org.apache.logging.log4j.plugins.Configurable;
-import org.apache.logging.log4j.plugins.Plugin;
-import org.apache.logging.log4j.plugins.PluginFactory;
-import org.apache.logging.log4j.util.Strings;
-
-/**
- * Appends a series of YAML events as strings serialized as bytes.
- *
- * <h2>Encoding</h2>
- * <p>
- * Appenders using this layout should have their {@code charset} set to {@code UTF-8} or {@code UTF-16}, otherwise
- * events containing non ASCII characters could result in corrupted log files.
- * </p>
- * <h2>Additional Fields</h2>
- * <p>
- * This property allows addition of custom fields into generated JSON.
- * {@code <YamlLayout><KeyValuePair key="foo" value="bar"/></YamlLayout>} inserts {@code foo: "bar"} directly into YAML
- * output. Supports Lookup expressions.
- * </p>
- */
-@Configurable(elementType = Layout.ELEMENT_TYPE, printObject = true)
-@Plugin
-public final class YamlLayout extends AbstractJacksonLayout {
-
- public static class Builder<B extends Builder<B>> extends AbstractJacksonLayout.Builder<B>
- implements org.apache.logging.log4j.plugins.util.Builder<YamlLayout> {
-
- public Builder() {
- super();
- setCharset(StandardCharsets.UTF_8);
- }
-
- @Override
- public YamlLayout build() {
- final String headerPattern = toStringOrNull(getHeader());
- final String footerPattern = toStringOrNull(getFooter());
- return new YamlLayout(
- getConfiguration(),
- isLocationInfo(),
- isProperties(),
- isComplete(),
- isCompact(),
- getEventEol(),
- headerPattern,
- footerPattern,
- getCharset(),
- isIncludeStacktrace(),
- isStacktraceAsString(),
- isIncludeNullDelimiter(),
- isIncludeTimeMillis(),
- getAdditionalFields());
- }
- }
-
- @JsonRootName(YamlConstants.EVENT)
- public static class YamlLogEventWithAdditionalFields extends LogEventWithAdditionalFields {
-
- public YamlLogEventWithAdditionalFields(final LogEvent logEvent, final Map<String, String> additionalFields) {
- super(logEvent, additionalFields);
- }
-
- @Override
- @JsonAnyGetter
- public Map<String, String> getAdditionalFields() {
- return super.getAdditionalFields();
- }
-
- @Override
- @JsonUnwrapped
- @JsonSerialize(as = LogEvent.class)
- public LogEvent getLogEvent() {
- return super.getLogEvent();
- }
- }
-
- private static final String DEFAULT_FOOTER = Strings.EMPTY;
-
- private static final String DEFAULT_HEADER = Strings.EMPTY;
-
- static final String CONTENT_TYPE = "application/yaml";
-
- /**
- * Creates a YAML Layout using the default settings. Useful for testing.
- *
- * @return A YAML Layout.
- */
- public static AbstractJacksonLayout createDefaultLayout() {
- return new YamlLayout(
- new DefaultConfiguration(),
- false,
- false,
- false,
- false,
- false,
- DEFAULT_HEADER,
- DEFAULT_FOOTER,
- StandardCharsets.UTF_8,
- true,
- false,
- false,
- false,
- null);
- }
-
- @PluginFactory
- public static <B extends Builder<B>> B newBuilder() {
- return new Builder<B>().asBuilder();
- }
-
- private YamlLayout(
- final Configuration config,
- final boolean locationInfo,
- final boolean properties,
- final boolean complete,
- final boolean compact,
- final boolean eventEol,
- final String headerPattern,
- final String footerPattern,
- final Charset charset,
- final boolean includeStacktrace,
- final boolean stacktraceAsString,
- final boolean includeNullDelimiter,
- final boolean includeTimeMillis,
- final KeyValuePair[] additionalFields) {
- super(
- config,
- new YamlJacksonFactory(includeStacktrace, stacktraceAsString)
- .newWriter(locationInfo, properties, compact, includeTimeMillis),
- charset,
- compact,
- complete,
- eventEol,
- PatternLayout.newSerializerBuilder()
- .setConfiguration(config)
- .setPattern(headerPattern)
- .setDefaultPattern(DEFAULT_HEADER)
- .build(),
- PatternLayout.newSerializerBuilder()
- .setConfiguration(config)
- .setPattern(footerPattern)
- .setDefaultPattern(DEFAULT_FOOTER)
- .build(),
- includeNullDelimiter,
- additionalFields);
- }
-
- @Override
- protected LogEventWithAdditionalFields createLogEventWithAdditionalFields(
- final LogEvent event, final Map<String, String> additionalFieldsMap) {
- return new YamlLogEventWithAdditionalFields(event, additionalFieldsMap);
- }
-
- @Override
- public Map<String, String> getContentFormat() {
- final Map<String, String> result = new HashMap<>();
- result.put("version", "3.0");
- return result;
- }
-
- /**
- * @return The content type.
- */
- @Override
- public String getContentType() {
- return CONTENT_TYPE + "; charset=" + this.getCharset();
- }
-
- /**
- * Returns appropriate YAML footer.
- *
- * @return a byte array containing the footer, closing the YAML array.
- */
- @Override
- public byte[] getFooter() {
- if (!this.complete) {
- return null;
- }
- final StringBuilder buf = new StringBuilder();
- buf.append(this.eol);
- final String str = serializeToString(getFooterSerializer());
- if (str != null) {
- buf.append(str);
- }
- buf.append(this.eol);
- return getBytes(buf.toString());
- }
-
- /**
- * Returns appropriate YAML header.
- *
- * @return a byte array containing the header, opening the YAML array.
- */
- @Override
- public byte[] getHeader() {
- if (!this.complete) {
- return null;
- }
- final StringBuilder buf = new StringBuilder();
- final String str = serializeToString(getHeaderSerializer());
- if (str != null) {
- buf.append(str);
- }
- buf.append(this.eol);
- return getBytes(buf.toString());
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/package-info.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/package-info.java
deleted file mode 100644
index 2fb299c8af..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/layout/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-@Export
-@Version("1.0.0")
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/package-info.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/package-info.java
deleted file mode 100644
index d501df47e1..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-@Export
-@Version("1.0.0")
-package org.apache.logging.log4j.jackson.yaml;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParser.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParser.java
deleted file mode 100644
index 765283088a..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParser.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.parser;
-
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.parser.AbstractJacksonLogEventParser;
-import org.apache.logging.log4j.jackson.yaml.Log4jYamlObjectMapper;
-
-/**
- * Parses the output from YamlLayout layout into instances of {@link LogEvent}.
- */
-public class YamlLogEventParser extends AbstractJacksonLogEventParser {
-
- public YamlLogEventParser() {
- super(new Log4jYamlObjectMapper());
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/package-info.java b/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/package-info.java
deleted file mode 100644
index 55263ea3ef..0000000000
--- a/log4j-layout-jackson-yaml/src/main/java/org/apache/logging/log4j/jackson/yaml/parser/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-@Export
-@Version("1.0.0")
-package org.apache.logging.log4j.jackson.yaml.parser;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/LevelMixInYamlTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/LevelMixInYamlTest.java
deleted file mode 100644
index 49fa796cf0..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/LevelMixInYamlTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.jackson.LevelMixInTest;
-
-public class LevelMixInYamlTest extends LevelMixInTest {
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jYamlObjectMapper();
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/MarkerMixInYamlTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/MarkerMixInYamlTest.java
deleted file mode 100644
index 4e60b07c28..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/MarkerMixInYamlTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.jackson.AbstractMarkerMixInTest;
-
-public class MarkerMixInYamlTest extends AbstractMarkerMixInTest {
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jYamlObjectMapper();
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/StackTraceElementYamlMixInTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/StackTraceElementYamlMixInTest.java
deleted file mode 100644
index e929fc5ec5..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/StackTraceElementYamlMixInTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
-import java.io.IOException;
-import org.apache.logging.log4j.jackson.Log4jStackTraceElementDeserializer;
-import org.junit.jupiter.api.Test;
-
-public class StackTraceElementYamlMixInTest {
-
- protected String aposToQuotes(final String json) {
- return json.replace("'", "\"");
- }
-
- private void roundtrip(final ObjectMapper mapper) throws IOException {
- final StackTraceElement expected =
- new StackTraceElement("package.SomeClass", "someMethod", "SomeClass.java", 123);
- final String s = mapper.writeValueAsString(expected);
- final StackTraceElement actual = mapper.readValue(s, StackTraceElement.class);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testFromYamlWithLog4jModule() throws Exception {
- final ObjectMapper mapper = new YAMLMapper();
- final boolean encodeThreadContextAsList = false;
- final SimpleModule module = new Log4jYamlModule(encodeThreadContextAsList, true, false);
- module.addDeserializer(StackTraceElement.class, new Log4jStackTraceElementDeserializer());
- mapper.registerModule(module);
- final StackTraceElement expected =
- new StackTraceElement("package.SomeClass", "someMethod", "SomeClass.java", 123);
- final StackTraceElement actual = mapper.readValue(
- "---\nclass: package.SomeClass\nmethod: someMethod\nfile: SomeClass.java\nline: 123\n...",
- StackTraceElement.class);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testFromYamlWithSimpleModule() throws Exception {
- final ObjectMapper mapper = new YAMLMapper();
- final SimpleModule module = new SimpleModule();
- module.addDeserializer(StackTraceElement.class, new Log4jStackTraceElementDeserializer());
- mapper.registerModule(module);
- final StackTraceElement expected =
- new StackTraceElement("package.SomeClass", "someMethod", "SomeClass.java", 123);
- final StackTraceElement actual = mapper.readValue(
- "---\nclass: package.SomeClass\nmethod: someMethod\nfile: SomeClass.java\nline: 123\n...",
- StackTraceElement.class);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testLog4jYamlObjectMapper() throws Exception {
- this.roundtrip(new Log4jYamlObjectMapper());
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/ConcurrentLoggingWithYamlLayoutTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/ConcurrentLoggingWithYamlLayoutTest.java
deleted file mode 100644
index 8515115ed6..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/ConcurrentLoggingWithYamlLayoutTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.LockSupport;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
-import org.apache.logging.log4j.test.junit.CleanUpFiles;
-import org.junit.jupiter.api.Test;
-
-/**
- * Like the test for LOG4J2-1769.
- */
-public class ConcurrentLoggingWithYamlLayoutTest {
-
- private static class LoggingThread extends Thread {
- private final Set<Thread> threads;
- private final Logger log;
-
- LoggingThread(final Set<Thread> threads, final Logger log) {
- this.threads = threads;
- this.log = log;
- }
-
- @Override
- public void run() {
- log.info(threads.size());
- try {
- for (int i = 0; i < 64; i++) {
- log.info("First message.");
- log.info("Second message.");
- }
- } finally {
- threads.remove(this);
- }
- }
- }
-
- private static final String PATH = "target/test-yaml-layout.log";
-
- @Test
- @CleanUpFiles(PATH)
- @LoggerContextSource("log4j2-yaml-layout.xml")
- public void testConcurrentLogging(final LoggerContext context) throws Throwable {
- final Logger log = context.getLogger(ConcurrentLoggingWithYamlLayoutTest.class);
- final Set<Thread> threads = Collections.synchronizedSet(new HashSet<>());
- final List<Throwable> thrown = Collections.synchronizedList(new ArrayList<>());
-
- for (int x = 0; x < Runtime.getRuntime().availableProcessors() * 2; x++) {
- final Thread t = new LoggingThread(threads, log);
- threads.add(t);
-
- // Appender is configured with ignoreExceptions="false";
- // any exceptions are propagated to the caller, so we can catch them here.
- t.setUncaughtExceptionHandler((t1, e) -> thrown.add(e));
- t.start();
- }
-
- while (!threads.isEmpty()) {
- log.info("not done going to sleep...");
- LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
- }
-
- // if any error occurred, fail this test
- if (!thrown.isEmpty()) {
- throw thrown.get(0);
- }
-
- // simple test to ensure content is not corrupted
- if (new File(PATH).exists()) {
- final List<String> lines = Files.readAllLines(new File(PATH).toPath(), Charset.defaultCharset());
- assertThat(lines.get(0), startsWith("---"));
- // TODO more
- }
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayoutTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayoutTest.java
deleted file mode 100644
index bcd1dc01e7..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/layout/YamlLayoutTest.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.layout;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Map;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.Logger;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-import org.apache.logging.log4j.core.impl.MutableLogEvent;
-import org.apache.logging.log4j.core.lookup.JavaLookup;
-import org.apache.logging.log4j.core.test.BasicConfigurationFactory;
-import org.apache.logging.log4j.core.test.appender.ListAppender;
-import org.apache.logging.log4j.core.test.junit.ConfigurationFactoryType;
-import org.apache.logging.log4j.core.test.layout.LogEventFixtures;
-import org.apache.logging.log4j.core.util.KeyValuePair;
-import org.apache.logging.log4j.jackson.AbstractJacksonLayout;
-import org.apache.logging.log4j.jackson.yaml.Log4jYamlObjectMapper;
-import org.apache.logging.log4j.message.SimpleMessage;
-import org.apache.logging.log4j.spi.AbstractLogger;
-import org.apache.logging.log4j.test.junit.UsingAnyThreadContext;
-import org.apache.logging.log4j.util.Strings;
-import org.junit.jupiter.api.Test;
-
-/**
- * Tests the YamlLayout class.
- */
-@UsingAnyThreadContext
-@ConfigurationFactoryType(BasicConfigurationFactory.class)
-public class YamlLayoutTest {
-
- LoggerContext ctx = LoggerContext.getContext();
-
- Logger rootLogger = this.ctx.getRootLogger();
-
- private void checkAt(final String expected, final int lineIndex, final List<String> list) {
- final String trimedLine = list.get(lineIndex).trim();
- assertEquals(trimedLine, expected, "Incorrect line index " + lineIndex + ": " + Strings.dquote(trimedLine));
- }
-
- private void checkContains(final String expected, final List<String> list) {
- for (final String string : list) {
- final String trimedLine = string.trim();
- if (trimedLine.equals(expected)) {
- return;
- }
- }
- fail("Cannot find " + expected + " in " + list);
- }
-
- private void checkMapEntry(final String key, final String value, final boolean compact, final String str) {
- // "name":"value"
- // final String expected = String.format("- key: \"%s\"\n value: \"%s\"", key, value);
- final String expected = String.format("%s: \"%s\"", key, value);
- assertThat(str, containsString(expected));
- }
-
- private void checkProperty(
- final String key, final String value, final boolean compact, final String str, final boolean isValue) {
- final String propSep = this.toPropertySeparator(compact, isValue);
- // {"key":"MDC.B","value":"B_Value"}
- final String expected = String.format("%s%s\"%s\"", key, propSep, value);
- assertThat(str, containsString(expected));
- }
-
- private void checkPropertyName(final String name, final boolean compact, final String str, final boolean isValue) {
- final String propSep = this.toPropertySeparator(compact, isValue);
- assertThat(str, containsString(name + propSep));
- }
-
- private void checkPropertyNameAbsent(
- final String name, final boolean compact, final String str, final boolean isValue) {
- final String propSep = this.toPropertySeparator(compact, isValue);
- assertThat(str, not(containsString(name + propSep)));
- }
-
- private String prepareYAMLForStacktraceTests(final boolean stacktraceAsString) {
- final Log4jLogEvent expected = LogEventFixtures.createLogEvent();
- // @formatter:off
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(ctx.getConfiguration())
- .setIncludeStacktrace(true)
- .setStacktraceAsString(stacktraceAsString)
- .build();
- // @formatter:on
- return layout.toSerializable(expected);
- }
-
- @Test
- public void testAdditionalFields() throws Exception {
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setLocationInfo(false)
- .setProperties(false)
- .setIncludeStacktrace(false)
- .setAdditionalFields(new KeyValuePair[] {
- new KeyValuePair("KEY1", "VALUE1"), new KeyValuePair("KEY2", "${java:runtime}"),
- })
- .setCharset(StandardCharsets.UTF_8)
- .setConfiguration(ctx.getConfiguration())
- .build();
- final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
- assertThat(str, containsString("KEY1: \"VALUE1\""));
- assertThat(str, containsString("KEY2: \"" + new JavaLookup().getRuntime() + "\""));
- }
-
- @Test
- public void testMutableLogEvent() throws Exception {
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setLocationInfo(false)
- .setProperties(false)
- .setIncludeStacktrace(false)
- .setAdditionalFields(new KeyValuePair[] {
- new KeyValuePair("KEY1", "VALUE1"), new KeyValuePair("KEY2", "${java:runtime}"),
- })
- .setCharset(StandardCharsets.UTF_8)
- .setConfiguration(ctx.getConfiguration())
- .build();
- final Log4jLogEvent logEvent = LogEventFixtures.createLogEvent();
- final MutableLogEvent mutableEvent = new MutableLogEvent();
- mutableEvent.initFrom(logEvent);
- final String strLogEvent = layout.toSerializable(logEvent);
- final String strMutableEvent = layout.toSerializable(mutableEvent);
- assertEquals(strLogEvent, strMutableEvent, strMutableEvent);
- }
-
- private void testAllFeatures(
- final boolean includeSource,
- final boolean compact,
- final boolean eventEol,
- final boolean includeContext,
- final boolean contextMapAslist,
- final boolean includeStacktrace)
- throws Exception {
- final Log4jLogEvent expected = LogEventFixtures.createLogEvent();
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(ctx.getConfiguration())
- .setLocationInfo(includeSource)
- .setProperties(includeContext)
- .setIncludeStacktrace(includeStacktrace)
- .setCharset(StandardCharsets.UTF_8)
- .build();
- final String str = layout.toSerializable(expected);
- // System.out.println(str);
- // Just check for \n since \r might or might not be there.
- assertEquals(!compact || eventEol, str.contains("\n"), str);
- assertEquals(includeSource, str.contains("source"), str);
- assertEquals(includeContext, str.contains("contextMap"), str);
- final Log4jLogEvent actual = new Log4jYamlObjectMapper(contextMapAslist, includeStacktrace, false)
- .readValue(str, Log4jLogEvent.class);
- LogEventFixtures.assertEqualLogEvents(expected, actual, includeSource, includeContext, includeStacktrace);
- if (includeContext) {
- this.checkMapEntry("MDC.A", "A_Value", compact, str);
- this.checkMapEntry("MDC.B", "B_Value", compact, str);
- }
- //
- assertNull(actual.getThrown());
- // make sure the names we want are used
- this.checkPropertyName("instant", compact, str, false);
- this.checkPropertyName("thread", compact, str, true); // and not threadName
- this.checkPropertyName("level", compact, str, true);
- this.checkPropertyName("loggerName", compact, str, true);
- this.checkPropertyName("marker", compact, str, false);
- this.checkPropertyName("name", compact, str, true);
- this.checkPropertyName("parents", compact, str, false);
- this.checkPropertyName("message", compact, str, true);
- this.checkPropertyName("thrown", compact, str, false);
- this.checkPropertyName("cause", compact, str, false);
- this.checkPropertyName("commonElementCount", compact, str, true);
- this.checkPropertyName("localizedMessage", compact, str, true);
- if (includeStacktrace) {
- this.checkPropertyName("extendedStackTrace", compact, str, false);
- this.checkPropertyName("class", compact, str, true);
- this.checkPropertyName("method", compact, str, true);
- this.checkPropertyName("file", compact, str, true);
- this.checkPropertyName("line", compact, str, true);
- this.checkPropertyName("exact", compact, str, true);
- this.checkPropertyName("location", compact, str, true);
- this.checkPropertyName("version", compact, str, true);
- } else {
- this.checkPropertyNameAbsent("extendedStackTrace", compact, str, false);
- }
- this.checkPropertyName("suppressed", compact, str, false);
- this.checkPropertyName("loggerFqcn", compact, str, true);
- this.checkPropertyName("endOfBatch", compact, str, true);
- if (includeContext) {
- this.checkPropertyName("contextMap", compact, str, false);
- } else {
- this.checkPropertyNameAbsent("contextMap", compact, str, false);
- }
- this.checkPropertyName("contextStack", compact, str, false);
- if (includeSource) {
- this.checkPropertyName("source", compact, str, false);
- } else {
- this.checkPropertyNameAbsent("source", compact, str, false);
- }
- // check some attrs
- this.checkProperty("loggerFqcn", "f.q.c.n", compact, str, true);
- this.checkProperty("loggerName", "a.B", compact, str, true);
- }
-
- @Test
- public void testContentType() {
- final AbstractJacksonLayout layout = YamlLayout.createDefaultLayout();
- assertEquals("application/yaml; charset=UTF-8", layout.getContentType());
- }
-
- @Test
- public void testDefaultCharset() {
- final AbstractJacksonLayout layout = YamlLayout.createDefaultLayout();
- assertEquals(StandardCharsets.UTF_8, layout.getCharset());
- }
-
- @Test
- public void testEscapeLayout() throws Exception {
- final Map<String, Appender> appenders = this.rootLogger.getAppenders();
- for (final Appender appender : appenders.values()) {
- this.rootLogger.removeAppender(appender);
- }
- final Configuration configuration = rootLogger.getContext().getConfiguration();
- // set up appender
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setLocationInfo(true)
- .setProperties(true)
- .setIncludeStacktrace(true)
- .setConfiguration(configuration)
- .build();
-
- final ListAppender appender = new ListAppender("List", null, layout, true, false);
- appender.start();
-
- // set appender on root and set level to debug
- this.rootLogger.addAppender(appender);
- this.rootLogger.setLevel(Level.DEBUG);
-
- // output starting message
- this.rootLogger.debug("Here is a quote ' and then a double quote \"");
-
- appender.stop();
-
- final List<String> list = appender.getMessages();
-
- this.checkAt("---", 0, list);
- this.checkContains("level: \"DEBUG\"", list);
- this.checkContains("message: \"Here is a quote ' and then a double quote \\\"\"", list);
- this.checkContains("loggerFqcn: \"" + AbstractLogger.class.getName() + "\"", list);
- for (final Appender app : appenders.values()) {
- this.rootLogger.addAppender(app);
- }
- }
-
- @Test
- public void testExcludeStacktrace() throws Exception {
- this.testAllFeatures(false, false, false, false, false, false);
- }
-
- @Test
- public void testIncludeNullDelimiterFalse() throws Exception {
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(ctx.getConfiguration())
- .setIncludeNullDelimiter(false)
- .build();
- final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
- assertThat(str, not(endsWith("\0")));
- }
-
- @Test
- public void testIncludeNullDelimiterTrue() throws Exception {
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(ctx.getConfiguration())
- .setIncludeNullDelimiter(true)
- .build();
- final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
- assertThat(str, endsWith("\0"));
- }
-
- /**
- * Test case for MDC conversion pattern.
- */
- @Test
- public void testLayout() throws Exception {
- final Map<String, Appender> appenders = this.rootLogger.getAppenders();
- for (final Appender appender : appenders.values()) {
- this.rootLogger.removeAppender(appender);
- }
- final Configuration configuration = rootLogger.getContext().getConfiguration();
- // set up appender
- // Use [[ and ]] to test header and footer (instead of [ and ])
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(configuration)
- .setLocationInfo(true)
- .setProperties(true)
- .setHeader("[[".getBytes(StandardCharsets.UTF_8))
- .setFooter("]]".getBytes(StandardCharsets.UTF_8))
- .setIncludeStacktrace(true)
- .build();
- final ListAppender appender = new ListAppender("List", null, layout, true, false);
- appender.start();
-
- // set appender on root and set level to debug
- this.rootLogger.addAppender(appender);
- this.rootLogger.setLevel(Level.DEBUG);
-
- // output starting message
- this.rootLogger.debug("starting mdc pattern test");
-
- this.rootLogger.debug("empty mdc");
-
- ThreadContext.put("key1", "value1");
- ThreadContext.put("key2", "value2");
-
- this.rootLogger.debug("filled mdc");
-
- ThreadContext.remove("key1");
- ThreadContext.remove("key2");
-
- this.rootLogger.error("finished mdc pattern test", new NullPointerException("test"));
-
- appender.stop();
-
- final List<String> list = appender.getMessages();
-
- this.checkAt("---", 0, list);
- this.checkContains("loggerFqcn: \"" + AbstractLogger.class.getName() + "\"", list);
- this.checkContains("level: \"DEBUG\"", list);
- this.checkContains("message: \"starting mdc pattern test\"", list);
- for (final Appender app : appenders.values()) {
- this.rootLogger.addAppender(app);
- }
- }
-
- @Test
- public void testLayoutLoggerName() throws Exception {
- final AbstractJacksonLayout layout = YamlLayout.newBuilder()
- .setConfiguration(ctx.getConfiguration())
- .setLocationInfo(false)
- .setProperties(false)
- .setIncludeStacktrace(true)
- .setCharset(StandardCharsets.UTF_8)
- .build();
- final Log4jLogEvent expected = Log4jLogEvent.newBuilder() //
- .setLoggerName("a.B") //
- .setLoggerFqcn("f.q.c.n") //
- .setLevel(Level.DEBUG) //
- .setMessage(new SimpleMessage("M")) //
- .setThreadName("threadName") //
- .setTimeMillis(1)
- .build();
- final String str = layout.toSerializable(expected);
- assertThat(str, containsString("loggerName: \"a.B\""));
- final Log4jLogEvent actual = new Log4jYamlObjectMapper(false, true, false).readValue(str, Log4jLogEvent.class);
- assertEquals(expected.getLoggerName(), actual.getLoggerName());
- assertEquals(expected, actual);
- }
-
- @Test
- public void testLocationOffCompactOffMdcOff() throws Exception {
- this.testAllFeatures(false, false, false, false, false, true);
- }
-
- @Test
- public void testLocationOnCompactOffEventEolOffMdcOn() throws Exception {
- this.testAllFeatures(true, false, false, true, false, true);
- }
-
- @Test
- public void testStacktraceAsNonString() throws Exception {
- final String str = prepareYAMLForStacktraceTests(false);
- assertThat(str, containsString("extendedStackTrace:\n - "));
- }
-
- @Test
- public void testStacktraceAsString() throws Exception {
- final String str = prepareYAMLForStacktraceTests(true);
- assertThat(str, containsString("extendedStackTrace: \"java.lang.NullPointerException"));
- }
-
- private String toPropertySeparator(final boolean compact, final boolean value) {
- return value ? ": " : ":";
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParserTest.java b/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParserTest.java
deleted file mode 100644
index 658eaddbbf..0000000000
--- a/log4j-layout-jackson-yaml/src/test/java/org/apache/logging/log4j/jackson/yaml/parser/YamlLogEventParserTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-package org.apache.logging.log4j.jackson.yaml.parser;
-
-import java.nio.charset.StandardCharsets;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.parser.ParseException;
-import org.apache.logging.log4j.core.test.parser.AbstractLogEventParserTest;
-import org.junit.Before;
-import org.junit.Test;
-
-public class YamlLogEventParserTest extends AbstractLogEventParserTest {
-
- private static final String YAML = "---\n" + "timeMillis: 1493121664118\n"
- + "instant:\n"
- + " epochSecond: 1493121664\n"
- + " nanoOfSecond: 118000000\n"
- + "thread: \"main\"\n"
- + "level: \"INFO\"\n"
- + "loggerName: \"HelloWorld\"\n"
- + "marker:\n"
- + " name: \"child\"\n"
- + " parents:\n"
- + " - name: \"parent\"\n"
- + " parents:\n"
- + " - name: \"grandparent\"\n"
- + "message: \"Hello, world!\"\n"
- + "thrown:\n"
- + " commonElementCount: 0\n"
- + " message: \"error message\"\n"
- + " name: \"java.lang.RuntimeException\"\n"
- + " extendedStackTrace:\n"
- + " - class: \"logtest.Main\"\n"
- + " method: \"main\"\n"
- + " file: \"Main.java\"\n"
- + " line: 29\n"
- + " exact: true\n"
- + " location: \"classes/\"\n"
- + " version: \"?\"\n"
- + "contextStack:\n"
- + "- \"one\"\n"
- + "- \"two\"\n"
- + "endOfBatch: false\n"
- + "loggerFqcn: \"org.apache.logging.log4j.spi.AbstractLogger\"\n"
- + "contextMap:\n"
- + " bar: \"BAR\"\n"
- + " foo: \"FOO\"\n"
- + "threadId: 1\n"
- + "threadPriority: 5\n"
- + "source:\n"
- + " class: \"logtest.Main\"\n"
- + " method: \"main\"\n"
- + " file: \"Main.java\"\n"
- + " line: 29";
-
- private YamlLogEventParser parser;
-
- @Before
- public void setup() {
- parser = new YamlLogEventParser();
- }
-
- @Test
- public void testByteArray() throws ParseException {
- final LogEvent logEvent = parser.parseFrom(YAML.getBytes(StandardCharsets.UTF_8));
- assertLogEvent(logEvent);
- }
-
- @Test
- public void testByteArrayOffsetLength() throws ParseException {
- final byte[] bytes = ("abc" + YAML + "def").getBytes(StandardCharsets.UTF_8);
- final LogEvent logEvent = parser.parseFrom(bytes, 3, bytes.length - 6);
- assertLogEvent(logEvent);
- }
-
- @Test
- public void testEmptyObject() throws ParseException {
- parser.parseFrom("---\n");
- }
-
- @Test
- public void testString() throws ParseException {
- final LogEvent logEvent = parser.parseFrom(YAML);
- assertLogEvent(logEvent);
- }
-
- @Test(expected = ParseException.class)
- public void testStringEmpty() throws ParseException {
- parser.parseFrom("");
- }
-
- @Test
- public void testStringIgnoreInvalidProperty() throws ParseException {
- parser.parseFrom("---\nfoo: \"bar\"\n");
- }
-
- @Test(expected = ParseException.class)
- public void testStringInvalidYaml() throws ParseException {
- parser.parseFrom("foobar");
- }
-
- @Test(expected = ParseException.class)
- public void testStringWrongPropertyType() throws ParseException {
- parser.parseFrom("---\nthreadId: \"foobar\"\n");
- }
-
- @Test
- public void testTimeMillisIgnored() throws ParseException {
- parser.parseFrom("---\ntimeMillis: \"foobar\"\n");
- }
-}
diff --git a/log4j-layout-jackson-yaml/src/test/resources/log4j2-yaml-layout.xml b/log4j-layout-jackson-yaml/src/test/resources/log4j2-yaml-layout.xml
deleted file mode 100644
index ec5d8422e4..0000000000
--- a/log4j-layout-jackson-yaml/src/test/resources/log4j2-yaml-layout.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
- -->
-<Configuration status="INFO">
- <Appenders>
- <File name="stdout" ignoreExceptions="false" fileName="target/test-yaml-layout.log" append="false">
- <YamlLayout compact="true" eventEol="true" />
- </File>
- </Appenders>
-
- <Loggers>
- <Root level="INFO">
- <AppenderRef ref="stdout" />
- </Root>
- </Loggers>
-</Configuration>
diff --git a/pom.xml b/pom.xml
index 2636875f32..73fb46a6ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -251,7 +251,6 @@
<module>log4j-layout-jackson</module>
<module>log4j-layout-jackson-json</module>
<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-mongodb4</module>
@@ -463,12 +462,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson-yaml</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
diff --git a/src/site/asciidoc/manual/layouts.adoc b/src/site/asciidoc/manual/layouts.adoc
index 1ca64172ed..361fa21a7e 100644
--- a/src/site/asciidoc/manual/layouts.adoc
+++ b/src/site/asciidoc/manual/layouts.adoc
@@ -2117,118 +2117,6 @@ values support link:lookups.html[lookups].
Additional link:../runtime-dependencies.html[runtime dependencies] are
required for using XmlLayout.
-[#YamlLayout]
-== YAML Layout
-
-Appends a series of YAML events as strings serialized as bytes.
-
-A YAML log event follows this pattern:
-
-[source,yaml]
-----
----
-instant:
- epochSecond: 1493121664
- nanoOfSecond: 118000000
-thread: "main"
-level: "INFO"
-loggerName: "HelloWorld"
-marker:
- name: "child"
- parents:
- - name: "parent"
- parents:
- - name: "grandparent"
-message: "Hello, world!"
-thrown:
- commonElementCount: 0
- message: "error message"
- name: "java.lang.RuntimeException"
- extendedStackTrace:
- - class: "logtest.Main"
- method: "main"
- file: "Main.java"
- line: 29
- exact: true
- location: "classes/"
- version: "?"
-contextStack:
-- "one"
-- "two"
-endOfBatch: false
-loggerFqcn: "org.apache.logging.log4j.spi.AbstractLogger"
-contextMap:
- bar: "BAR"
- foo: "FOO"
-threadId: 1
-threadPriority: 5
-source:
- class: "logtest.Main"
- method: "main"
- file: "Main.java"
- line: 29
-----
-
-.YamlLayout Parameters
-[cols="1m,1,4"]
-|===
-|Parameter Name |Type |Description
-
-|charset
-|String
-|The character set to use when converting to a byte
-array. The value must be a valid
-https://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html[Charset].
-If not specified, UTF-8 will be used.
-
-|properties
-|boolean
-|If true, the appender includes the thread context
-map in the generated YAML. Defaults to false.
-
-|locationInfo
-|boolean
-a|
-If true, the appender includes the location information in the generated
-YAML. Defaults to false.
-
-Generating link:#LocationInformation[location information] is an
-expensive operation and may impact performance. Use with caution.
-
-|includeStacktrace
-|boolean
-|If true, include full stacktrace of any
-logged
-https://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html[Throwable]
-(optional, default to true).
-
-|stacktraceAsString
-|boolean
-|Whether to format the stacktrace as a
-string, and not a nested object (optional, defaults to false).
-
-|includeNullDelimiter
-|boolean
-|Whether to include NULL byte as
-delimiter after each event (optional, default to false).
-|===
-
-To include any custom field in the output, use following syntax:
-
-[source,xml]
-----
-<YamlLayout>
- <KeyValuePair key="additionalField1" value="constant value"/>
- <KeyValuePair key="additionalField2" value="$${ctx:key}"/>
-</YamlLayout>
-----
-
-Custom fields are always last, in the order they are declared. The
-values support link:lookups.html[lookups].
-
-Additional link:../runtime-dependencies.html[runtime dependencies] are
-required for using YamlLayout.
-
[#LocationInformation]
== Location Information
diff --git a/src/site/asciidoc/runtime-dependencies.adoc b/src/site/asciidoc/runtime-dependencies.adoc
index 7403454f99..ad747872e2 100644
--- a/src/site/asciidoc/runtime-dependencies.adoc
+++ b/src/site/asciidoc/runtime-dependencies.adoc
@@ -493,9 +493,6 @@ the exact list of JAR files needed for these features.
|XML Layout
|https://github.com/FasterXML/jackson[Jackson core, databind and dataformat XML] and `com.fasterxml.woodstox:woodstox-core:5.0.2`
-|YAML Layout
-|https://github.com/FasterXML/jackson[Jackson core, databind] and https://github.com/FasterXML/jackson-dataformat-yaml[YAML data format]
-
|Async Loggers
|http://lmax-exchange.github.io/disruptor/[LMAX Disruptor]
diff --git a/src/site/markdown/log4j-layout-jackson-yaml.md b/src/site/markdown/log4j-layout-jackson-yaml.md
deleted file mode 100644
index 6fb90f1df7..0000000000
--- a/src/site/markdown/log4j-layout-jackson-yaml.md
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- vim: set syn=markdown : -->
-<!--
- 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.
--->
-
-# Apache Log4j Layout for Jackson YAML module
-
-As of Log4j 3.0.0, the layout based on Jackson YAML has moved from the existing module log4j-core to the new modules log4j-layout-jackson-yaml.
-
-## Requirements
-
-This module was introduced in Log4j 2.11.0 and requires Jackson.
-
-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.
diff --git a/src/site/site.xml b/src/site/site.xml
index 220e0e5749..e4281db0bd 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -180,7 +180,6 @@
<item name="Serialized" href="/manual/layouts.html#SerializedLayout"/>
<item name="Syslog" href="/manual/layouts.html#SyslogLayout"/>
<item name="XML" href="/manual/layouts.html#XMLLayout"/>
- <item name="YAML" href="/manual/layouts.html#YamlLayout"/>
<item name="Location Information" href="/manual/layouts.html#LocationInformation"/>
</item>