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 2024/01/16 08:30:52 UTC
(logging-log4j2) 01/01: Remove `log4j-layout-jackson` and `log4j-layout-jackson-xml`
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch main-remove-XmlLayout
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 388ed6da011a9cd0fcb10bc2a071cfe6ed7ce102
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Tue Jan 16 09:30:27 2024 +0100
Remove `log4j-layout-jackson` and `log4j-layout-jackson-xml`
---
.../core/appender/XmlCompactFileAppenderTest.java | 79 ----
.../XmlCompactFileAppenderValidationTest.java | 104 -----
.../XmlCompactFileAsyncAppenderValidationTest.java | 80 ----
.../core/appender/XmlCompleteFileAppenderTest.java | 179 -------
.../log4j/core/appender/XmlFileAppenderTest.java | 75 ---
.../appender/XmlRandomAccessFileAppenderTest.java | 88 ----
.../log4j/core/test/categories/Layouts.java | 2 -
.../src/main/resources/Log4j-config.xsd | 8 -
.../org/apache/logging/log4j/core/XmlEvents.java | 60 ---
.../logging/log4j/core/appender/Jira739Test.java | 49 --
log4j-core-test/src/test/resources/LOG4J2-739.xml | 44 --
.../test/resources/XmlCompactFileAppenderTest.xml | 30 --
.../XmlCompactFileAppenderValidationTest.xml | 30 --
.../XmlCompactFileAsyncAppenderValidationTest.xml | 30 --
.../test/resources/XmlCompleteFileAppenderTest.xml | 30 --
.../src/test/resources/XmlFileAppenderTest.xml | 30 --
.../resources/XmlRandomAccessFileAppenderTest.xml | 30 --
log4j-core-test/src/test/resources/xml-events.xml | 35 --
log4j-core/src/main/resources/Log4j-config.xsd | 8 -
log4j-layout-jackson-xml/pom.xml | 124 -----
.../jackson/xml/AbstractLogEventXmlMixIn.java | 132 ------
.../xml/ContextDataAsEntryListXmlSerializer.java | 35 --
.../xml/ExtendedStackTraceElementXmlMixIn.java | 108 -----
.../logging/log4j/jackson/xml/InstantXmlMixIn.java | 53 ---
.../logging/log4j/jackson/xml/Log4jXmlModule.java | 51 --
.../log4j/jackson/xml/Log4jXmlObjectMapper.java | 47 --
.../xml/LogEventWithContextListXmlMixIn.java | 44 --
.../logging/log4j/jackson/xml/MarkerXmlMixIn.java | 76 ---
.../jackson/xml/StackTraceElementXmlMixIn.java | 69 ---
...rowableProxyWithStacktraceAsStringXmlMixIn.java | 74 ---
.../ThrowableProxyWithoutStacktraceXmlMixIn.java | 74 ---
.../log4j/jackson/xml/ThrowableProxyXmlMixIn.java | 75 ---
.../logging/log4j/jackson/xml/XmlMapEntry.java | 38 --
.../jackson/xml/XmlSetupContextInitializer.java | 57 ---
.../jackson/xml/layout/Log4jXmlPrettyPrinter.java | 54 ---
.../jackson/xml/layout/XmlJacksonFactory.java | 79 ----
.../log4j/jackson/xml/layout/XmlLayout.java | 233 ----------
.../log4j/jackson/xml/layout/package-info.java | 22 -
.../logging/log4j/jackson/xml/package-info.java | 22 -
.../log4j/jackson/xml/LevelMixInXmlTest.java | 39 --
.../log4j/jackson/xml/MarkerMixInXmlTest.java | 28 --
.../jackson/xml/StackTraceElementXmlMixInTest.java | 80 ----
.../layout/ConcurrentLoggingWithXmlLayoutTest.java | 115 -----
.../jackson/xml/layout/ThrowableProxyXmlTest.java | 30 --
.../log4j/jackson/xml/layout/XmlLayoutTest.java | 461 ------------------
log4j-layout-jackson/pom.xml | 90 ----
.../log4j/jackson/AbstractJacksonFactory.java | 82 ----
.../log4j/jackson/AbstractJacksonLayout.java | 514 ---------------------
.../log4j/jackson/AbstractLogEventMixIn.java | 73 ---
.../ContextDataAsEntryListDeserializer.java | 56 ---
.../jackson/ContextDataAsEntryListSerializer.java | 65 ---
.../log4j/jackson/ContextDataDeserializer.java | 62 ---
.../log4j/jackson/ContextDataSerializer.java | 63 ---
.../jackson/ExtendedStackTraceElementMixIn.java | 112 -----
.../apache/logging/log4j/jackson/InstantMixIn.java | 54 ---
.../logging/log4j/jackson/JsonConstants.java | 37 --
.../apache/logging/log4j/jackson/LevelMixIn.java | 42 --
.../Log4jStackTraceElementDeserializer.java | 114 -----
.../jackson/LogEventWithContextListMixIn.java | 133 ------
.../org/apache/logging/log4j/jackson/MapEntry.java | 108 -----
.../apache/logging/log4j/jackson/MarkerMixIn.java | 68 ---
.../logging/log4j/jackson/MessageSerializer.java | 44 --
.../MutableThreadContextStackDeserializer.java | 50 --
.../log4j/jackson/ObjectMessageSerializer.java | 45 --
.../log4j/jackson/SimpleMessageDeserializer.java | 44 --
.../log4j/jackson/SimpleModuleInitializer.java | 41 --
.../log4j/jackson/StackTraceElementConstants.java | 31 --
.../log4j/jackson/StackTraceElementMixIn.java | 69 ---
.../logging/log4j/jackson/ThrowableProxyMixIn.java | 67 ---
.../ThrowableProxyWithStacktraceAsStringMixIn.java | 67 ---
.../ThrowableProxyWithoutStacktraceMixIn.java | 67 ---
.../apache/logging/log4j/jackson/XmlConstants.java | 40 --
.../jackson/layout/AbstractJacksonLayout.java | 393 ----------------
.../logging/log4j/jackson/layout/package-info.java | 22 -
.../apache/logging/log4j/jackson/package-info.java | 26 --
.../log4j/jackson/AbstractMarkerMixInTest.java | 98 ----
.../logging/log4j/jackson/LevelMixInTest.java | 98 ----
.../log4j/jackson/ThrowableProxyJacksonTest.java | 48 --
pom.xml | 2 -
.../changelog/.3.x.x/remove_layout_jackson.xml | 19 +-
.../changelog/.3.x.x/remove_layout_jackson_xml.xml | 19 +-
src/site/_release-notes/_3.x.x.adoc | 2 +
src/site/asciidoc/manual/layouts.adoc | 151 ------
src/site/asciidoc/manual/migration.adoc | 8 +-
src/site/asciidoc/runtime-dependencies.adoc | 3 -
src/site/site.xml | 1 -
86 files changed, 16 insertions(+), 6323 deletions(-)
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java
deleted file mode 100644
index a7fa1eecde..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderTest.java
+++ /dev/null
@@ -1,79 +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.core.appender;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
-import org.apache.logging.log4j.core.test.CoreLoggerContexts;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Tests a "compact" XML file, no extra spaces or end of lines.
- */
-@Category(Layouts.Xml.class)
-public class XmlCompactFileAppenderTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty(Log4jPropertyKey.CONFIG_LOCATION.getSystemKey(), "XmlCompactFileAppenderTest.xml");
- }
-
- @Test
- public void testFlushAtEndOfBatch() throws Exception {
- final File file = new File("target", "XmlCompactFileAppenderTest.log");
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- final String logMsg = "Message flushed with immediate flush=false";
- log.info(logMsg);
- CoreLoggerContexts.stopLoggerContext(false, file); // stop async thread
-
- String line1;
- try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
- line1 = reader.readLine();
- } finally {
- file.delete();
- }
- assertNotNull("line1", line1);
- final String msg1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg1 + ']', line1.contains(msg1));
-
- final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">";
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg2 + ']', line1.contains(msg2));
-
- final String msg3 = "<Event ";
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg3 + ']', line1.contains(msg3));
-
- final String msg4 = logMsg;
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg4 + ']', line1.contains(msg4));
-
- final String location = "testFlushAtEndOfBatch";
- assertTrue("no location", !line1.contains(location));
-
- assertTrue(line1.indexOf('\r') == -1);
- assertTrue(line1.indexOf('\n') == -1);
- }
-}
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderValidationTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderValidationTest.java
deleted file mode 100644
index 070debf51c..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAppenderValidationTest.java
+++ /dev/null
@@ -1,104 +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.core.appender;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configurator;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.xml.sax.SAXException;
-
-/**
- * Tests XML validation for a "compact" XML file, no extra spaces or end of lines.
- */
-@Ignore
-@Category(Layouts.Xml.class)
-public class XmlCompactFileAppenderValidationTest {
-
- private LoggerContext loggerContext;
-
- @Before
- public void before() {
- this.loggerContext = Configurator.initialize(
- XmlCompactFileAppenderValidationTest.class.getName(),
- "target/test-classes/XmlCompactFileAppenderValidationTest.xml");
- }
-
- @After
- public void after() {
- // Just in case, an @Test blew up
- Configurator.shutdown(this.loggerContext);
- }
-
- @Test
- public void validateXmlSchemaThrowable() throws Exception {
- final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- try {
- throw new IllegalArgumentException("IAE");
- } catch (final IllegalArgumentException e) {
- log.warn("Message 1", e);
- }
- Configurator.shutdown(this.loggerContext);
- this.validateXmlSchema(file);
- }
-
- @Test
- public void validateXmlSchema() throws Exception {
- final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- log.warn("Message 1");
- log.info("Message 2");
- log.debug("Message 3");
- Configurator.shutdown(this.loggerContext);
- this.validateXmlSchema(file);
- }
-
- @Test
- public void validateXmlNoEvents() throws Exception {
- final File file = new File("target", "XmlCompactFileAppenderValidationTest.log.xml");
- file.delete();
- Configurator.shutdown(this.loggerContext);
- this.validateXmlSchema(file);
- }
-
- private void validateXmlSchema(final File file) throws SAXException, IOException {
- final URL schemaFile = this.getClass().getClassLoader().getResource("Log4j-events.xsd");
- final Source xmlFile = new StreamSource(file);
- final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- final Schema schema = schemaFactory.newSchema(schemaFile);
- final Validator validator = schema.newValidator();
- validator.validate(xmlFile);
- }
-}
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAsyncAppenderValidationTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAsyncAppenderValidationTest.java
deleted file mode 100644
index da8dd9c9c3..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompactFileAsyncAppenderValidationTest.java
+++ /dev/null
@@ -1,80 +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.core.appender;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
-import org.apache.logging.log4j.core.test.CoreLoggerContexts;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.xml.sax.SAXException;
-
-/**
- * Tests XML validation for a "compact" XML file, no extra spaces or end of lines.
- */
-@Ignore
-@Category(Layouts.Xml.class)
-public class XmlCompactFileAsyncAppenderValidationTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty(
- Log4jPropertyKey.CONFIG_LOCATION.getSystemKey(), "XmlCompactFileAsyncAppenderValidationTest.xml");
- }
-
- @Test
- public void validateXmlSchemaSimple() throws Exception {
- final File file = new File("target", "XmlCompactFileAsyncAppenderValidationTest.log.xml");
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- log.warn("Message 1");
- log.info("Message 2");
- log.debug("Message 3");
- CoreLoggerContexts.stopLoggerContext(file); // stop async thread
- this.validateXmlSchema(file);
- }
-
- @Test
- public void validateXmlSchemaNoEvents() throws Exception {
- final File file = new File("target", "XmlCompactFileAsyncAppenderValidationTest.log.xml");
- file.delete();
- CoreLoggerContexts.stopLoggerContext(file); // stop async thread
- this.validateXmlSchema(file);
- }
-
- private void validateXmlSchema(final File file) throws SAXException, IOException {
- final URL schemaFile = this.getClass().getClassLoader().getResource("Log4j-events.xsd");
- final Source xmlFile = new StreamSource(file);
- final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- final Schema schema = schemaFactory.newSchema(schemaFile);
- final Validator validator = schema.newValidator();
- validator.validate(xmlFile);
- }
-}
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
deleted file mode 100644
index 92b6d474d3..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlCompleteFileAppenderTest.java
+++ /dev/null
@@ -1,179 +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.core.appender;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.util.List;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.selector.ContextSelector;
-import org.apache.logging.log4j.core.selector.CoreContextSelectors;
-import org.apache.logging.log4j.core.test.CoreLoggerContexts;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
-import org.apache.logging.log4j.test.junit.CleanFiles;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * Tests a "complete" XML file a.k.a. a well-formed XML file.
- */
-@RunWith(Parameterized.class)
-@Category(Layouts.Xml.class)
-public class XmlCompleteFileAppenderTest {
-
- public XmlCompleteFileAppenderTest(final Class<ContextSelector> contextSelector) {
- this.loggerContextRule = new LoggerContextRule("XmlCompleteFileAppenderTest.xml", contextSelector);
- this.cleanFiles = new CleanFiles(logFile);
- this.ruleChain = RuleChain.outerRule(cleanFiles).around(loggerContextRule);
- }
-
- @Parameters(name = "{0}")
- public static Class<?>[] getParameters() {
- return CoreContextSelectors.CLASSES;
- }
-
- private final File logFile = new File("target", "XmlCompleteFileAppenderTest.log");
- private final LoggerContextRule loggerContextRule;
- private final CleanFiles cleanFiles;
-
- @Rule
- public RuleChain ruleChain;
-
- @Test
- public void testFlushAtEndOfBatch() throws Exception {
- final Logger logger = this.loggerContextRule.getLogger("com.foo.Bar");
- final String logMsg = "Message flushed with immediate flush=false";
- logger.info(logMsg);
- CoreLoggerContexts.stopLoggerContext(false, logFile); // stop async thread
-
- String line1;
- String line2;
- String line3;
- String line4;
- String line5;
- try (final BufferedReader reader = new BufferedReader(new FileReader(logFile))) {
- line1 = reader.readLine();
- line2 = reader.readLine();
- reader.readLine(); // ignore the empty line after the <Events> root
- line3 = reader.readLine();
- line4 = reader.readLine();
- line5 = reader.readLine();
- } finally {
- logFile.delete();
- }
- assertNotNull("line1", line1);
- final String msg1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg1 + ']', line1.equals(msg1));
-
- assertNotNull("line2", line2);
- final String msg2 = "<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">";
- assertTrue("line2 incorrect: [" + line2 + "], does not contain: [" + msg2 + ']', line2.equals(msg2));
-
- assertNotNull("line3", line3);
- final String msg3 = "<Event ";
- assertTrue("line3 incorrect: [" + line3 + "], does not contain: [" + msg3 + ']', line3.contains(msg3));
-
- assertNotNull("line4", line4);
- final String msg4 = "<Instant epochSecond=";
- assertTrue("line4 incorrect: [" + line4 + "], does not contain: [" + msg4 + ']', line4.contains(msg4));
-
- assertNotNull("line5", line5);
- final String msg5 = logMsg;
- assertTrue("line5 incorrect: [" + line5 + "], does not contain: [" + msg5 + ']', line5.contains(msg5));
-
- final String location = "testFlushAtEndOfBatch";
- assertTrue("no location", !line1.contains(location));
- }
-
- /**
- * Test the indentation of the Events XML.
- * <p>Expected Events XML is as below.</p>
- * <pre>
- * <?xml version="1.0" encoding="UTF-8"?>
- * <Events xmlns="http://logging.apache.org/log4j/2.0/events">
- *
- * <Event xmlns="http://logging.apache.org/log4j/2.0/events" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="12" threadPriority="5">
- * <Instant epochSecond="1515889414" nanoOfSecond="144000000" epochMillisecond="1515889414144" nanoOfMillisecond="0"/>
- * <Message>First Msg tag must be in level 2 after correct indentation</Message>
- * </Event>
- *
- * <Event xmlns="http://logging.apache.org/log4j/2.0/events" thread="main" level="INFO" loggerName="com.foo.Bar" endOfBatch="true" loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger" threadId="12" threadPriority="5">
- * <Instant epochSecond="1515889414" nanoOfSecond="144000000" epochMillisecond="1515889414144" nanoOfMillisecond="0"/>
- * <Message>Second Msg tag must also be in level 2 after correct indentation</Message>
- * </Event>
- * </Events>
- * </pre>
- * @throws Exception
- */
- @Test
- public void testChildElementsAreCorrectlyIndented() throws Exception {
- final Logger logger = this.loggerContextRule.getLogger("com.foo.Bar");
- final String firstLogMsg = "First Msg tag must be in level 2 after correct indentation";
- logger.info(firstLogMsg);
- final String secondLogMsg = "Second Msg tag must also be in level 2 after correct indentation";
- logger.info(secondLogMsg);
- CoreLoggerContexts.stopLoggerContext(false, logFile); // stop async thread
-
- final int[] indentations = {
- 0, // "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- 0, // "<Events xmlns=\"http://logging.apache.org/log4j/2.0/events\">\n"
- -1, // empty
- 2, // " <Event xmlns=\"http://logging.apache.org/log4j/2.0/events\" thread=\"main\" level=\"INFO\"
- // loggerName=\"com.foo.Bar\" endOfBatch=\"true\"
- // loggerFqcn=\"org.apache.logging.log4j.spi.AbstractLogger\" threadId=\"12\" threadPriority=\"5\">\n"
- 4, // " <Instant epochSecond=\"1515889414\" nanoOfSecond=\"144000000\" epochMillisecond=\"1515889414144\"
- // nanoOfMillisecond=\"0\"/>\n"
- 4, // " <Message>First Msg tag must be in level 2 after correct indentation</Message>\n" +
- 2, // " </Event>\n"
- -1, // empty
- 2, // " <Event xmlns=\"http://logging.apache.org/log4j/2.0/events\" thread=\"main\" level=\"INFO\"
- // loggerName=\"com.foo.Bar\" endOfBatch=\"true\"
- // loggerFqcn=\"org.apache.logging.log4j.spi.AbstractLogger\" threadId=\"12\" threadPriority=\"5\">\n" +
- 4, // " <Instant epochSecond=\"1515889414\" nanoOfSecond=\"144000000\" epochMillisecond=\"1515889414144\"
- // nanoOfMillisecond=\"0\"/>\n" +
- 4, // " <Message>Second Msg tag must also be in level 2 after correct indentation</Message>\n" +
- 2, // " </Event>\n" +
- 0, // "</Events>\n";
- };
- final List<String> lines1 = Files.readAllLines(logFile.toPath(), Charset.forName("UTF-8"));
-
- assertEquals("number of lines", indentations.length, lines1.size());
- for (int i = 0; i < indentations.length; i++) {
- final String line = lines1.get(i);
- if (line.trim().isEmpty()) {
- assertEquals(-1, indentations[i]);
- } else {
- final String padding = " ".substring(0, indentations[i]);
- assertTrue(
- "Expected " + indentations[i] + " leading spaces but got: " + line, line.startsWith(padding));
- }
- }
- }
-}
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.java
deleted file mode 100644
index 40416dede2..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlFileAppenderTest.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.core.appender;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.util.List;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
-import org.apache.logging.log4j.core.test.CoreLoggerContexts;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Tests a "complete" XML file a.k.a. a well-formed XML file.
- */
-@Category(Layouts.Xml.class)
-public class XmlFileAppenderTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty(Log4jPropertyKey.CONFIG_LOCATION.getSystemKey(), "XmlFileAppenderTest.xml");
- }
-
- @Test
- public void testFlushAtEndOfBatch() throws Exception {
- final File file = new File("target", "XmlFileAppenderTest.log");
- // System.out.println(f.getAbsolutePath());
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- final String logMsg = "Message flushed with immediate flush=false";
- log.info(logMsg);
- CoreLoggerContexts.stopLoggerContext(false, file); // stop async thread
-
- final List<String> lines = Files.readAllLines(file.toPath(), Charset.forName("UTF8"));
- file.delete();
-
- final String[] expect = {
- "", // ? unsure why initial empty line...
- "<Event ", //
- "<Instant epochSecond=", //
- logMsg, //
- "</Event>", //
- };
-
- for (int i = 0; i < expect.length; i++) {
- assertTrue(
- "Expected line " + i + " to contain " + expect[i] + " but got: " + lines.get(i),
- lines.get(i).contains(expect[i]));
- }
-
- final String location = "testFlushAtEndOfBatch";
- assertTrue("no location", !lines.get(0).contains(location));
- }
-}
diff --git a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlRandomAccessFileAppenderTest.java b/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlRandomAccessFileAppenderTest.java
deleted file mode 100644
index 311833947d..0000000000
--- a/log4j-core-its/src/test/java/org/apache/logging/log4j/core/appender/XmlRandomAccessFileAppenderTest.java
+++ /dev/null
@@ -1,88 +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.core.appender;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
-import org.apache.logging.log4j.core.test.CoreLoggerContexts;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Tests a "complete" XML file a.k.a. a well-formed XML file.
- */
-@Category(Layouts.Xml.class)
-public class XmlRandomAccessFileAppenderTest {
-
- @BeforeClass
- public static void beforeClass() {
- System.setProperty(Log4jPropertyKey.CONFIG_LOCATION.getSystemKey(), "XmlRandomAccessFileAppenderTest.xml");
- }
-
- @Test
- @Ignore
- public void testFlushAtEndOfBatch() throws Exception {
- final File file = new File("target", "XmlRandomAccessFileAppenderTest.log");
- // System.out.println(f.getAbsolutePath());
- file.delete();
- final Logger log = LogManager.getLogger("com.foo.Bar");
- final String logMsg = "Message flushed with immediate flush=false";
- log.info(logMsg);
- CoreLoggerContexts.stopLoggerContext(false, file); // stop async thread
-
- String line1;
- String line2;
- String line3;
- String line4;
- try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
- line1 = reader.readLine();
- line2 = reader.readLine();
- line3 = reader.readLine();
- line4 = reader.readLine();
- } finally {
- file.delete();
- }
- assertNotNull("line1", line1);
- final String msg1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- assertTrue("line1 incorrect: [" + line1 + "], does not contain: [" + msg1 + ']', line1.equals(msg1));
-
- assertNotNull("line2", line2);
- final String msg2 = "<log4j:events xmlns:log4j=\"http://logging.apache.org/log4j/\">";
- assertTrue("line2 incorrect: [" + line2 + "], does not contain: [" + msg2 + ']', line2.equals(msg2));
-
- assertNotNull("line3", line3);
- final String msg3 = "<log4j:event ";
- assertTrue("line3 incorrect: [" + line3 + "], does not contain: [" + msg3 + ']', line3.contains(msg3));
-
- assertNotNull("line4", line4);
- final String msg4 = logMsg;
- assertTrue("line4 incorrect: [" + line4 + "], does not contain: [" + msg4 + ']', line4.contains(msg4));
-
- final String location = "testFlushAtEndOfBatch";
- assertTrue("no location", !line1.contains(location));
- }
-}
diff --git a/log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/categories/Layouts.java b/log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/categories/Layouts.java
index 4dcb2ca554..4b78f1fdc4 100644
--- a/log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/categories/Layouts.java
+++ b/log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/categories/Layouts.java
@@ -23,6 +23,4 @@ public interface Layouts {
interface Csv {}
interface Jansi {}
-
- interface Xml {}
}
diff --git a/log4j-core-test/src/main/resources/Log4j-config.xsd b/log4j-core-test/src/main/resources/Log4j-config.xsd
index c99ede546b..c17d1c59e3 100644
--- a/log4j-core-test/src/main/resources/Log4j-config.xsd
+++ b/log4j-core-test/src/main/resources/Log4j-config.xsd
@@ -557,13 +557,6 @@
</complexContent>
</complexType>
- <complexType name="XmlLayoutType">
- <complexContent>
- <extension base="tns:AbstractJsonLayoutType" />
- </complexContent>
- </complexType>
-
-
<!--
================================================================================================================================
Appender types
@@ -625,7 +618,6 @@
<element name="HtmlLayout" type="tns:HtmlLayoutType" />
<element name="MessageLayout" type="tns:MessageLayoutType" />
<element name="PatternLayout" type="tns:PatternLayoutType" />
- <element name="XmlLayout" type="tns:XmlLayoutType" />
</choice>
<group ref="tns:FilterChoiceGroup" minOccurs="0" />
</sequence>
diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/XmlEvents.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/XmlEvents.java
deleted file mode 100644
index 1515d2d729..0000000000
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/XmlEvents.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.core;
-
-import java.util.Locale;
-import org.apache.logging.log4j.EventLogger;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
-import org.apache.logging.log4j.message.AsynchronouslyFormattable;
-import org.apache.logging.log4j.message.StructuredDataMessage;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-@LoggerContextSource("xml-events.xml")
-@Disabled("TODO")
-public class XmlEvents {
-
- @Test
- public void testEvents() {
- ThreadContext.put("loginId", "JohnDoe");
- ThreadContext.put("ipAddress", "192.168.0.120");
- ThreadContext.put("locale", Locale.US.getDisplayName());
- final TransferMessage msg = new TransferMessage();
- msg.put("ToAccount", "123456");
- msg.put("FromAccount", "123457");
- msg.put("Amount", "200.00");
- EventLogger.logEvent(msg);
- msg.setCompletionStatus("Transfer Complete");
- EventLogger.logEvent(msg);
- ThreadContext.clearMap();
- // TODO: do something with the results
-
- }
-
- @AsynchronouslyFormattable
- private static class TransferMessage extends StructuredDataMessage {
-
- public TransferMessage() {
- super("Transfer@18060", null, "Audit");
- }
-
- public void setCompletionStatus(final String msg) {
- setMessageFormat(msg);
- }
- }
-}
diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java
deleted file mode 100644
index 38f49041fd..0000000000
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/Jira739Test.java
+++ /dev/null
@@ -1,49 +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.core.appender;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.Configurator;
-
-/**
- * Shows how to use ANSI escape codes to color messages. Each message is printed to the console in color, but the rest
- * of the log entry (time stamp for example) is in the default color for that console.
- * <p>
- * Running from a Windows command line from the root of the project:
- * </p>
- *
- * <pre>
- * java -classpath log4j-core\target\test-classes;log4j-core\target\classes;log4j-api\target\classes;%HOME%\.m2\repository\org\fusesource\jansi\jansi\1.14\jansi-1.14.jar; org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiMessagesMain log4j-core/target/test-classes/log4j2-console.xml
- * </pre>
- */
-public class Jira739Test {
-
- private static final Logger LOG = LogManager.getLogger(Jira739Test.class);
-
- public static void main(final String[] args) {
- try (final LoggerContext ctx =
- Configurator.initialize(Jira739Test.class.getName(), "target/test-classes/LOG4J2-739.xml")) {
- for (int i = 0; i < 10; i++) {
- LOG.trace("Entering Log4j Example " + i + " times");
- LOG.error("Ohh!Failed!");
- LOG.trace("Exiting Log4j Example." + i + " times");
- }
- }
- }
-}
diff --git a/log4j-core-test/src/test/resources/LOG4J2-739.xml b/log4j-core-test/src/test/resources/LOG4J2-739.xml
deleted file mode 100644
index 968965405f..0000000000
--- a/log4j-core-test/src/test/resources/LOG4J2-739.xml
+++ /dev/null
@@ -1,44 +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="off">
- <Properties>
- <Property name="name">app</Property>
- <Property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</Property>
- </Properties>
- <Appenders>
- <Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
- </Console>
- <RollingFile name="RollingFile" fileName="logs/${name}.log" filePattern="logs/$${date:yyyy-MM}/${name}-%d{yyyy-MM-dd}-%i.log.gz">
- <XmlLayout complete="true" />
- <Policies>
- <SizeBasedTriggeringPolicy size="100"/>
- </Policies>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Root level="error">
- <AppenderRef ref="Console" />
- </Root>
- <Logger name="log4j2poc.Log4J2Example" level="TRACE" />
- <Root level="ERROR">
- <AppenderRef ref="CONSOLE"/>
- <AppenderRef ref="RollingFile" />
- </Root>
- </Loggers>
- </Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlCompactFileAppenderTest.xml b/log4j-core-test/src/test/resources/XmlCompactFileAppenderTest.xml
deleted file mode 100644
index e26866a022..0000000000
--- a/log4j-core-test/src/test/resources/XmlCompactFileAppenderTest.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="OFF">
- <Appenders>
- <File name="XmlFile" fileName="target/XmlCompactFileAppenderTest.log" immediateFlush="false" append="false">
- <XmlLayout complete="true" compact="true" charset="UTF-8"/>
- </File>
- </Appenders>
-
- <Loggers>
- <AsyncRoot level="info" includeLocation="false">
- <AppenderRef ref="XmlFile"/>
- </AsyncRoot>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlCompactFileAppenderValidationTest.xml b/log4j-core-test/src/test/resources/XmlCompactFileAppenderValidationTest.xml
deleted file mode 100644
index 059c54c154..0000000000
--- a/log4j-core-test/src/test/resources/XmlCompactFileAppenderValidationTest.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="OFF">
- <Appenders>
- <File name="XmlFile" fileName="target/XmlCompactFileAppenderValidationTest.log.xml" immediateFlush="false" append="false">
- <XmlLayout complete="true" compact="true" charset="UTF-8"/>
- </File>
- </Appenders>
-
- <Loggers>
- <Root level="info" includeLocation="false">
- <AppenderRef ref="XmlFile"/>
- </Root>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlCompactFileAsyncAppenderValidationTest.xml b/log4j-core-test/src/test/resources/XmlCompactFileAsyncAppenderValidationTest.xml
deleted file mode 100644
index 3bf389e4b3..0000000000
--- a/log4j-core-test/src/test/resources/XmlCompactFileAsyncAppenderValidationTest.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="OFF">
- <Appenders>
- <File name="XmlFile" fileName="target/XmlCompactFileAsyncAppenderValidationTest.log.xml" immediateFlush="false" append="false">
- <XmlLayout complete="true" compact="true" charset="UTF-8"/>
- </File>
- </Appenders>
-
- <Loggers>
- <AsyncRoot level="info" includeLocation="false">
- <AppenderRef ref="XmlFile"/>
- </AsyncRoot>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlCompleteFileAppenderTest.xml b/log4j-core-test/src/test/resources/XmlCompleteFileAppenderTest.xml
deleted file mode 100644
index c1ae32da49..0000000000
--- a/log4j-core-test/src/test/resources/XmlCompleteFileAppenderTest.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="OFF">
- <Appenders>
- <File name="XmlFile" fileName="target/XmlCompleteFileAppenderTest.log" immediateFlush="false" append="false">
- <XmlLayout complete="true" charset="UTF-8"/>
- </File>
- </Appenders>
-
- <Loggers>
- <AsyncRoot level="info" includeLocation="false">
- <AppenderRef ref="XmlFile"/>
- </AsyncRoot>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlFileAppenderTest.xml b/log4j-core-test/src/test/resources/XmlFileAppenderTest.xml
deleted file mode 100644
index 4860f5a42b..0000000000
--- a/log4j-core-test/src/test/resources/XmlFileAppenderTest.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="OFF">
- <Appenders>
- <File name="XmlFile" fileName="target/XmlFileAppenderTest.log" immediateFlush="false" append="false">
- <XmlLayout charset="UTF-8"/>
- </File>
- </Appenders>
-
- <Loggers>
- <AsyncRoot level="info" includeLocation="false">
- <AppenderRef ref="XmlFile"/>
- </AsyncRoot>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/XmlRandomAccessFileAppenderTest.xml b/log4j-core-test/src/test/resources/XmlRandomAccessFileAppenderTest.xml
deleted file mode 100644
index c687144c5d..0000000000
--- a/log4j-core-test/src/test/resources/XmlRandomAccessFileAppenderTest.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="OFF">
- <Appenders>
- <RandomAccessFile name="XmlRandomAccessFile" fileName="target/XmlRandomAccessFileAppenderTest.log" immediateFlush="false" append="false">
- <XmlLayout complete="true"/>
- </RandomAccessFile>
- </Appenders>
-
- <Loggers>
- <AsyncRoot level="info" includeLocation="false">
- <AppenderRef ref="XmlRandomAccessFile"/>
- </AsyncRoot>
- </Loggers>
-</Configuration>
diff --git a/log4j-core-test/src/test/resources/xml-events.xml b/log4j-core-test/src/test/resources/xml-events.xml
deleted file mode 100644
index 8bc634df68..0000000000
--- a/log4j-core-test/src/test/resources/xml-events.xml
+++ /dev/null
@@ -1,35 +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="OFF" name="MyApp">
- <Appenders>
- <Console name="STDOUT">
- <PatternLayout pattern="%d [%p] %c %m%n"/>
- </Console>
- <File name="events" fileName="target/events.xml" append="false">
- <XmlLayout properties="true" complete="true"/>
- </File>
- </Appenders>
- <Loggers>
- <Logger name="EventLogger" level="info">
- <AppenderRef ref="events"/>
- </Logger>
- <Root level="warn">
- <AppenderRef ref="STDOUT"/>
- </Root>
- </Loggers>
-</Configuration>
diff --git a/log4j-core/src/main/resources/Log4j-config.xsd b/log4j-core/src/main/resources/Log4j-config.xsd
index c99ede546b..c17d1c59e3 100644
--- a/log4j-core/src/main/resources/Log4j-config.xsd
+++ b/log4j-core/src/main/resources/Log4j-config.xsd
@@ -557,13 +557,6 @@
</complexContent>
</complexType>
- <complexType name="XmlLayoutType">
- <complexContent>
- <extension base="tns:AbstractJsonLayoutType" />
- </complexContent>
- </complexType>
-
-
<!--
================================================================================================================================
Appender types
@@ -625,7 +618,6 @@
<element name="HtmlLayout" type="tns:HtmlLayoutType" />
<element name="MessageLayout" type="tns:MessageLayoutType" />
<element name="PatternLayout" type="tns:PatternLayoutType" />
- <element name="XmlLayout" type="tns:XmlLayoutType" />
</choice>
<group ref="tns:FilterChoiceGroup" minOccurs="0" />
</sequence>
diff --git a/log4j-layout-jackson-xml/pom.xml b/log4j-layout-jackson-xml/pom.xml
deleted file mode 100644
index c212ad4644..0000000000
--- a/log4j-layout-jackson-xml/pom.xml
+++ /dev/null
@@ -1,124 +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-xml</artifactId>
- <name>Apache Log4j Layout for Jackson XML</name>
- <description>Apache Log4j Layout for Jackson XML.</description>
- <properties>
- <log4jParentDir>${basedir}/..</log4jParentDir>
-
- <!--
- ~ 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.xml;substitute="jackson-dataformat-xml",
- <!-- 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-1.2-api</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</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.apache.logging.log4j</groupId>
- <artifactId>log4j-layout-jackson</artifactId>
- <type>test-jar</type>
- <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>
-
- <!-- Enable Log4j plugin processing -->
- <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>
-
- <!-- Illegal access is disabled by default in Java 16 due to JEP-396.
- We are relaxing it for tests. -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
-</project>
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/AbstractLogEventXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/AbstractLogEventXmlMixIn.java
deleted file mode 100644
index a2583a4973..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/AbstractLogEventXmlMixIn.java
+++ /dev/null
@@ -1,132 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonFilter;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext.ContextStack;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.core.time.Instant;
-import org.apache.logging.log4j.jackson.AbstractLogEventMixIn;
-import org.apache.logging.log4j.jackson.ContextDataAsEntryListDeserializer;
-import org.apache.logging.log4j.jackson.Log4jStackTraceElementDeserializer;
-import org.apache.logging.log4j.jackson.MessageSerializer;
-import org.apache.logging.log4j.jackson.SimpleMessageDeserializer;
-import org.apache.logging.log4j.jackson.XmlConstants;
-import org.apache.logging.log4j.message.Message;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-
-/**
- * <pre>AbstractLogEventMixIn
- *├─ XmlLogEventMixIn
- *├──── XmlLogEventWithContextListMixIn
- *├──── XmlLogEventWithContextMapMixIn
- *├─ JsonLogEventMixIn
- *├──── JsonLogEventWithContextListMixIn
- *├──── JsonLogEventWithContextMapMixIn</pre>
- */
-@JacksonXmlRootElement(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_EVENT)
-@JsonFilter(AbstractLogEventMixIn.JSON_FILTER_ID)
-@JsonPropertyOrder({
- // @formatter:off
- AbstractLogEventMixIn.ATTR_THREAD,
- AbstractLogEventMixIn.ATTR_LEVEL,
- AbstractLogEventMixIn.ATTR_LOGGER_NAME,
- AbstractLogEventMixIn.ATTR_LOGGER_FQCN,
- AbstractLogEventMixIn.ATTR_END_OF_BATCH,
- XmlConstants.ELT_INSTANT,
- XmlConstants.ELT_MARKER,
- XmlConstants.ELT_MESSAGE,
- AbstractLogEventXmlMixIn.ELT_THROWN,
- XmlConstants.ELT_CONTEXT_MAP,
- XmlConstants.ELT_CONTEXT_STACK,
- XmlConstants.ELT_SOURCE
-})
-// @formatter:on
-public abstract class AbstractLogEventXmlMixIn extends AbstractLogEventMixIn {
-
- public static final String ELT_THROWN = "Thrown";
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CONTEXT_MAP)
- @JsonSerialize(using = ContextDataAsEntryListXmlSerializer.class)
- @JsonDeserialize(using = ContextDataAsEntryListDeserializer.class)
- @Override
- public abstract ReadOnlyStringMap getContextData();
-
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CONTEXT_STACK)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CONTEXT_STACK_ITEM)
- @Override
- public abstract ContextStack getContextStack();
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_INSTANT)
- @Override
- public abstract Instant getInstant();
-
- @JacksonXmlProperty(isAttribute = true)
- @Override
- public abstract Level getLevel();
-
- @JacksonXmlProperty(isAttribute = true)
- @Override
- public abstract String getLoggerFqcn();
-
- @JacksonXmlProperty(isAttribute = true)
- @Override
- public abstract String getLoggerName();
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_MARKER)
- @Override
- public abstract Marker getMarker();
-
- @JsonSerialize(using = MessageSerializer.class)
- @JsonDeserialize(using = SimpleMessageDeserializer.class)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_MESSAGE)
- @Override
- public abstract Message getMessage();
-
- @JsonDeserialize(using = Log4jStackTraceElementDeserializer.class)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SOURCE)
- @Override
- public abstract StackTraceElement getSource();
-
- @Override
- @JacksonXmlProperty(isAttribute = true, localName = ATTR_THREAD_ID)
- public abstract long getThreadId();
-
- @Override
- @JacksonXmlProperty(isAttribute = true, localName = ATTR_THREAD)
- public abstract String getThreadName();
-
- @Override
- @JacksonXmlProperty(isAttribute = true, localName = ATTR_THREAD_PRIORITY)
- public abstract int getThreadPriority();
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_THROWN)
- @Override
- public abstract ThrowableProxy getThrownProxy();
-
- @JacksonXmlProperty(isAttribute = true)
- @Override
- public abstract boolean isEndOfBatch();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ContextDataAsEntryListXmlSerializer.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ContextDataAsEntryListXmlSerializer.java
deleted file mode 100644
index 80ada81681..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ContextDataAsEntryListXmlSerializer.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.xml;
-
-import org.apache.logging.log4j.jackson.ContextDataAsEntryListSerializer;
-import org.apache.logging.log4j.jackson.MapEntry;
-
-public class ContextDataAsEntryListXmlSerializer extends ContextDataAsEntryListSerializer {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected MapEntry createMapEntry(final String key, final String value) {
- return new XmlMapEntry(key, value);
- }
-
- @Override
- protected MapEntry[] createMapEntryArray(final int size) {
- return new XmlMapEntry[size];
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ExtendedStackTraceElementXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ExtendedStackTraceElementXmlMixIn.java
deleted file mode 100644
index fb327c0b2e..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ExtendedStackTraceElementXmlMixIn.java
+++ /dev/null
@@ -1,108 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.core.impl.ExtendedClassInfo;
-import org.apache.logging.log4j.jackson.ExtendedStackTraceElementMixIn;
-
-public abstract class ExtendedStackTraceElementXmlMixIn extends ExtendedStackTraceElementMixIn {
-
- private static final long serialVersionUID = 1L;
-
- @JsonCreator
- public ExtendedStackTraceElementXmlMixIn(
- // @formatter:off
- @JsonProperty(ATTR_CLASS_LOADER_NAME) final String classLoaderName,
- @JsonProperty(ATTR_MODULE) final String moduleName,
- @JsonProperty(ATTR_MODULE_VERSION) final String moduleVersion,
- @JsonProperty(ATTR_CLASS) final String declaringClass,
- @JsonProperty(ATTR_METHOD) final String methodName,
- @JsonProperty(ATTR_FILE) final String fileName,
- @JsonProperty(ATTR_LINE) final int lineNumber,
- @JsonProperty(ATTR_EXACT) final boolean exact,
- @JsonProperty(ATTR_LOCATION) final String location,
- @JsonProperty(ATTR_VERSION) final String version
- // @formatter:on
- ) {
- super(
- classLoaderName,
- moduleName,
- moduleVersion,
- declaringClass,
- methodName,
- fileName,
- lineNumber,
- exact,
- location,
- version);
- }
-
- @Override
- @JacksonXmlProperty(localName = ATTR_CLASS_LOADER_NAME, isAttribute = true)
- public abstract String getClassLoaderName();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_MODULE, isAttribute = true)
- public abstract String getModuleName();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_MODULE_VERSION, isAttribute = true)
- public abstract String getModuleVersion();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_CLASS, isAttribute = true)
- public abstract String getClassName();
-
- @Override
- @JacksonXmlProperty(isAttribute = true)
- public abstract boolean getExact();
-
- @Override
- @JsonIgnore
- public abstract ExtendedClassInfo getExtraClassInfo();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_FILE, isAttribute = true)
- public abstract String getFileName();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_LINE, isAttribute = true)
- public abstract int getLineNumber();
-
- @Override
- @JacksonXmlProperty(isAttribute = true)
- public abstract String getLocation();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_METHOD, isAttribute = true)
- public abstract String getMethodName();
-
- @JsonIgnore
- abstract StackTraceElement getStackTraceElement();
-
- @Override
- @JacksonXmlProperty(isAttribute = true)
- public abstract String getVersion();
-
- @Override
- @JsonIgnore
- public abstract boolean isNativeMethod();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/InstantXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/InstantXmlMixIn.java
deleted file mode 100644
index fca81b29df..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/InstantXmlMixIn.java
+++ /dev/null
@@ -1,53 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.core.time.Instant;
-import org.apache.logging.log4j.jackson.InstantMixIn;
-
-/**
- * Jackson mix-in for {@link Instant}.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- *
- * @see Marker
- */
-abstract class InstantXmlMixIn extends InstantMixIn {
-
- @JsonCreator
- protected InstantXmlMixIn(
- // @formatter:off
- @JsonProperty(ATTR_EPOCH_SECOND) final long epochSecond,
- @JsonProperty(ATTR_NANO_OF_SECOND) final int nanoOfSecond)
- // @formatter:on
- {
- super(epochSecond, nanoOfSecond);
- }
-
- @Override
- @JacksonXmlProperty(localName = ATTR_EPOCH_SECOND, isAttribute = true)
- public abstract long getEpochSecond();
-
- @Override
- @JacksonXmlProperty(localName = ATTR_NANO_OF_SECOND, isAttribute = true)
- public abstract int getNanoOfSecond();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlModule.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlModule.java
deleted file mode 100644
index 6d1419de0b..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlModule.java
+++ /dev/null
@@ -1,51 +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.xml;
-
-import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
-import org.apache.logging.log4j.jackson.SimpleModuleInitializer;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- * <p>
- * Extends Jackson's {@link JacksonXmlModule} for Log4j XML's specific needs.
- * </p>
- */
-final class Log4jXmlModule extends JacksonXmlModule {
-
- private static final long serialVersionUID = 1L;
- private final boolean includeStacktrace;
- private final boolean stacktraceAsString;
-
- Log4jXmlModule(final boolean includeStacktrace, final boolean stacktraceAsString) {
- super();
- this.includeStacktrace = includeStacktrace;
- this.stacktraceAsString = stacktraceAsString;
- // MUST init here.
- // Calling this from setupModule is too late!
- new SimpleModuleInitializer().initialize(this, false);
- }
-
- @Override
- public void setupModule(final SetupContext context) {
- // Calling super is a MUST!
- super.setupModule(context);
- new XmlSetupContextInitializer().setupModule(context, includeStacktrace, stacktraceAsString);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlObjectMapper.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlObjectMapper.java
deleted file mode 100644
index 657324a018..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/Log4jXmlObjectMapper.java
+++ /dev/null
@@ -1,47 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-
-/**
- * A Jackson XML {@link ObjectMapper} initialized for Log4j.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class Log4jXmlObjectMapper extends XmlMapper {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Create a new instance using the {@code Log4jXmlModule}.
- */
- public Log4jXmlObjectMapper() {
- this(true, false);
- }
-
- /**
- * Create a new instance using the {@code Log4jXmlModule}.
- */
- public Log4jXmlObjectMapper(final boolean includeStacktrace, final boolean stacktraceAsString) {
- super(new Log4jXmlModule(includeStacktrace, stacktraceAsString));
- this.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/LogEventWithContextListXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/LogEventWithContextListXmlMixIn.java
deleted file mode 100644
index b7d9eca9b8..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/LogEventWithContextListXmlMixIn.java
+++ /dev/null
@@ -1,44 +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.xml;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.jackson.ContextDataAsEntryListDeserializer;
-import org.apache.logging.log4j.jackson.XmlConstants;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-
-/**
- * <pre>
- * AbstractLogEventMixIn
- *├─ AbstractLogEventXmlMixIn
- *├──── LogEventWithContextListXmlMixIn
- *├──── LogEventWithContextMapXmlMixIn
- *├─ JsonLogEventMixIn
- *├──── JsonLogEventWithContextListMixIn
- *├──── JsonLogEventWithContextMapMixIn
- * </pre>
- */
-public abstract class LogEventWithContextListXmlMixIn extends AbstractLogEventXmlMixIn {
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CONTEXT_MAP)
- @JsonSerialize(using = ContextDataAsEntryListXmlSerializer.class)
- @JsonDeserialize(using = ContextDataAsEntryListDeserializer.class)
- @Override
- public abstract ReadOnlyStringMap getContextData();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/MarkerXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/MarkerXmlMixIn.java
deleted file mode 100644
index 71142a4556..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/MarkerXmlMixIn.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.xml;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.jackson.MarkerMixIn;
-import org.apache.logging.log4j.jackson.XmlConstants;
-
-/**
- * Jackson mix-in for {@link Marker}.
- * <p>
- * If we want to deal with more than one {@link Marker} implementation then recode these annotations to include
- * metadata.
- * </p>
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- * <p>
- * Example XML:
- * </p>
- *
- * <pre>
- * <Marker name="Marker1">
- * <Parents>
- * <Marker name="ParentMarker1">
- * <Parents>
- * <Marker name="GrandMotherMarker"/>
- * <Marker name="GrandFatherMarker"/>
- * </Parents>
- * </Marker>
- * <Marker name="ParentMarker2"/>
- * </Parents>
- * </Marker>
- * </pre>
- *
- * @see Marker
- */
-// Alternate for multiple Marker implementation.
-// @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-@JsonDeserialize(as = org.apache.logging.log4j.MarkerManager.Log4jMarker.class)
-abstract class MarkerXmlMixIn extends MarkerMixIn {
- public static final String ATTR_NAME = "name";
-
- @JsonCreator
- protected MarkerXmlMixIn(@JsonProperty(ATTR_NAME) final String name) {
- super(name);
- }
-
- @Override
- @JacksonXmlProperty(isAttribute = true)
- public abstract String getName();
-
- @Override
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_PARENTS)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_MARKER)
- public abstract Marker[] getParents();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixIn.java
deleted file mode 100644
index 684ca3b034..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixIn.java
+++ /dev/null
@@ -1,69 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.jackson.StackTraceElementConstants;
-import org.apache.logging.log4j.jackson.StackTraceElementMixIn;
-
-abstract class StackTraceElementXmlMixIn extends StackTraceElementMixIn {
-
- @JsonCreator
- protected StackTraceElementXmlMixIn(
- // @formatter:off
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS_LOADER_NAME) final String classLoaderName,
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE) final String moduleName,
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE_VERSION) final String moduleVersion,
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS) final String declaringClass,
- @JsonProperty(StackTraceElementConstants.ATTR_METHOD) final String methodName,
- @JsonProperty(StackTraceElementConstants.ATTR_FILE) final String fileName,
- @JsonProperty(StackTraceElementConstants.ATTR_LINE) final int lineNumber)
- // @formatter:on
- {
- super(classLoaderName, moduleName, moduleVersion, declaringClass, methodName, fileName, lineNumber);
- }
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_CLASS_LOADER_NAME, isAttribute = true)
- protected abstract String getClassLoaderName();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_MODULE, isAttribute = true)
- protected abstract String getModuleName();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_MODULE_VERSION, isAttribute = true)
- protected abstract String getModuleVersion();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_CLASS, isAttribute = true)
- protected abstract String getClassName();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_FILE, isAttribute = true)
- protected abstract String getFileName();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_LINE, isAttribute = true)
- protected abstract int getLineNumber();
-
- @Override
- @JacksonXmlProperty(localName = StackTraceElementConstants.ATTR_METHOD, isAttribute = true)
- protected abstract String getMethodName();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithStacktraceAsStringXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithStacktraceAsStringXmlMixIn.java
deleted file mode 100644
index 556695a531..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithStacktraceAsStringXmlMixIn.java
+++ /dev/null
@@ -1,74 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.jackson.ThrowableProxyWithStacktraceAsStringMixIn;
-import org.apache.logging.log4j.jackson.XmlConstants;
-
-public abstract class ThrowableProxyWithStacktraceAsStringXmlMixIn extends ThrowableProxyWithStacktraceAsStringMixIn {
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CAUSE)
- private ThrowableProxyWithStacktraceAsStringMixIn causeProxy;
-
- @JacksonXmlProperty(isAttribute = true)
- private int commonElementCount;
-
- @JsonIgnore
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JacksonXmlProperty(isAttribute = true)
- private String localizedMessage;
-
- @JacksonXmlProperty(isAttribute = true)
- private String message;
-
- @JacksonXmlProperty(isAttribute = true)
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @Override
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @Override
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_EXTENDED_STACK_TRACE)
- public abstract String getExtendedStackTraceAsString();
-
- @Override
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @Override
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED_ITEM)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @Override
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @Override
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithoutStacktraceXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithoutStacktraceXmlMixIn.java
deleted file mode 100644
index 0167a0f451..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyWithoutStacktraceXmlMixIn.java
+++ /dev/null
@@ -1,74 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.jackson.ThrowableProxyWithoutStacktraceMixIn;
-import org.apache.logging.log4j.jackson.XmlConstants;
-
-public abstract class ThrowableProxyWithoutStacktraceXmlMixIn extends ThrowableProxyWithoutStacktraceMixIn {
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CAUSE)
- private ThrowableProxyWithoutStacktraceMixIn causeProxy;
-
- @JacksonXmlProperty(isAttribute = true)
- private int commonElementCount;
-
- @JsonIgnore
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JacksonXmlProperty(isAttribute = true)
- private String localizedMessage;
-
- @JacksonXmlProperty(isAttribute = true)
- private String message;
-
- @JacksonXmlProperty(isAttribute = true)
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @Override
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @Override
- @JsonIgnore
- public abstract String getExtendedStackTraceAsString();
-
- @Override
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @Override
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED_ITEM)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @Override
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @Override
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyXmlMixIn.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyXmlMixIn.java
deleted file mode 100644
index 15dafe7a94..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/ThrowableProxyXmlMixIn.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.xml;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.jackson.ThrowableProxyMixIn;
-import org.apache.logging.log4j.jackson.XmlConstants;
-
-public abstract class ThrowableProxyXmlMixIn extends ThrowableProxyMixIn {
-
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_CAUSE)
- private ThrowableProxyMixIn causeProxy;
-
- @JacksonXmlProperty(isAttribute = true)
- private int commonElementCount;
-
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_EXTENDED_STACK_TRACE)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_EXTENDED_STACK_TRACE_ITEM)
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JacksonXmlProperty(isAttribute = true)
- private String localizedMessage;
-
- @JacksonXmlProperty(isAttribute = true)
- private String message;
-
- @JacksonXmlProperty(isAttribute = true)
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @Override
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @Override
- @JsonIgnore
- public abstract String getExtendedStackTraceAsString();
-
- @Override
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @Override
- @JacksonXmlElementWrapper(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED)
- @JacksonXmlProperty(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_SUPPRESSED_ITEM)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @Override
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @Override
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlMapEntry.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlMapEntry.java
deleted file mode 100644
index 1c61514641..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlMapEntry.java
+++ /dev/null
@@ -1,38 +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.xml;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import org.apache.logging.log4j.jackson.MapEntry;
-
-@JsonPropertyOrder({"key", "value"})
-class XmlMapEntry extends MapEntry {
-
- @JacksonXmlProperty(isAttribute = true)
- private String key;
-
- @JacksonXmlProperty(isAttribute = true)
- private String value;
-
- @JsonCreator
- public XmlMapEntry(@JsonProperty("key") final String key, @JsonProperty("value") final String value) {
- super(key, value);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlSetupContextInitializer.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlSetupContextInitializer.java
deleted file mode 100644
index b1a8c0672a..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/XmlSetupContextInitializer.java
+++ /dev/null
@@ -1,57 +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.xml;
-
-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.LevelMixIn;
-
-/**
- * Used to set up {@link SetupContext} from different {@link SimpleModule}s.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-class XmlSetupContextInitializer {
-
- 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, StackTraceElementXmlMixIn.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, MarkerXmlMixIn.class);
- context.setMixInAnnotations(Level.class, LevelMixIn.class);
- context.setMixInAnnotations(Instant.class, InstantXmlMixIn.class);
- context.setMixInAnnotations(LogEvent.class, LogEventWithContextListXmlMixIn.class);
- // Log4j Core classes: we do not want to bring in Jackson at runtime if we do not have to.
- context.setMixInAnnotations(ExtendedStackTraceElement.class, ExtendedStackTraceElementXmlMixIn.class);
- context.setMixInAnnotations(
- ThrowableProxy.class,
- includeStacktrace
- ? (stacktraceAsString
- ? ThrowableProxyWithStacktraceAsStringXmlMixIn.class
- : ThrowableProxyXmlMixIn.class)
- : ThrowableProxyWithoutStacktraceXmlMixIn.class);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/Log4jXmlPrettyPrinter.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/Log4jXmlPrettyPrinter.java
deleted file mode 100644
index e7873830fa..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/Log4jXmlPrettyPrinter.java
+++ /dev/null
@@ -1,54 +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.xml.layout;
-
-import com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter;
-import javax.xml.stream.XMLStreamException;
-import org.codehaus.stax2.XMLStreamWriter2;
-
-/**
- * When <Event>s are written into a XML file; the "Event" object is not the root element, but an element named
- * <Events> created using {@link XmlLayout#getHeader()} and {@link XmlLayout#getFooter()} methods.
- * <p>
- * {@link com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter} is used to print the Event object into
- * XML; hence it assumes <Event> tag as the root element, so it prints the <Event> tag without any
- * indentation. To add an indentation to the <Event> tag; hence an additional indentation for any
- * sub-elements, this class is written. As an additional task, to avoid the blank line printed after the ending
- * </Event> tag, the {@code #writePrologLinefeed(XMLStreamWriter2)} method is also overridden.
- * </p>
- */
-class Log4jXmlPrettyPrinter extends DefaultXmlPrettyPrinter {
-
- private static final long serialVersionUID = 1L;
-
- Log4jXmlPrettyPrinter(final int nesting) {
- _nesting = nesting;
- }
-
- /**
- * Sets the nesting level to 1 rather than 0, so the "Event" tag will get indentation of next level below root.
- */
- @Override
- public DefaultXmlPrettyPrinter createInstance() {
- return new Log4jXmlPrettyPrinter(XmlJacksonFactory.DEFAULT_INDENT);
- }
-
- @Override
- public void writePrologLinefeed(final XMLStreamWriter2 sw) throws XMLStreamException {
- // nothing
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlJacksonFactory.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlJacksonFactory.java
deleted file mode 100644
index e765f2e13f..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlJacksonFactory.java
+++ /dev/null
@@ -1,79 +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.xml.layout;
-
-import com.fasterxml.jackson.core.PrettyPrinter;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.jackson.AbstractJacksonFactory;
-import org.apache.logging.log4j.jackson.JsonConstants;
-import org.apache.logging.log4j.jackson.XmlConstants;
-import org.apache.logging.log4j.jackson.xml.Log4jXmlObjectMapper;
-
-class XmlJacksonFactory extends AbstractJacksonFactory {
-
- static final int DEFAULT_INDENT = 1;
-
- public XmlJacksonFactory(final boolean includeStacktrace, final boolean stacktraceAsString) {
- super(includeStacktrace, stacktraceAsString);
- }
-
- @Override
- protected String getPropertyNameForContextMap() {
- return XmlConstants.ELT_CONTEXT_MAP;
- }
-
- @Override
- protected String getPropertyNameForTimeMillis() {
- return XmlConstants.ELT_TIME_MILLIS;
- }
-
- @Override
- protected String getPropertyNameForInstant() {
- return XmlConstants.ELT_INSTANT;
- }
-
- @Override
- protected String getPropertyNameForNanoTime() {
- return JsonConstants.ELT_NANO_TIME;
- }
-
- @Override
- protected String getPropertyNameForSource() {
- return XmlConstants.ELT_SOURCE;
- }
-
- @Override
- protected String getPropertyNameForStackTrace() {
- return XmlConstants.ELT_EXTENDED_STACK_TRACE;
- }
-
- @Override
- protected PrettyPrinter newCompactPrinter() {
- // Yes, null is the proper answer.
- return null;
- }
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jXmlObjectMapper(includeStacktrace, stacktraceAsString);
- }
-
- @Override
- protected PrettyPrinter newPrettyPrinter() {
- return new Log4jXmlPrettyPrinter(DEFAULT_INDENT);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayout.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayout.java
deleted file mode 100644
index beac4c87de..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayout.java
+++ /dev/null
@@ -1,233 +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.xml.layout;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-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.util.KeyValuePair;
-import org.apache.logging.log4j.jackson.AbstractJacksonLayout;
-import org.apache.logging.log4j.jackson.XmlConstants;
-import org.apache.logging.log4j.plugins.Configurable;
-import org.apache.logging.log4j.plugins.Plugin;
-import org.apache.logging.log4j.plugins.PluginFactory;
-
-/**
- * Appends a series of {@code event} elements as defined in the <a href="log4j.dtd">log4j.dtd</a>.
- *
- * <h2>Complete well-formed XML vs. fragment XML</h2>
- * <p>
- * If you configure {@code complete="true"}, the appender outputs a well-formed XML document where the default namespace
- * is the log4j namespace {@value XmlConstants#XML_NAMESPACE}. By default, with {@code complete="false"}, you should
- * include the output as an <em>external entity</em> in a separate file to form a well-formed XML document.
- * </p>
- * <p>
- * If {@code complete="false"}, the appender does not write the XML processing instruction and the root element.
- * </p>
- * <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>Pretty vs. compact XML</h2>
- * <p>
- * By default, the XML layout is not compact (compact = not "pretty") with {@code compact="false"}, which means the
- * appender uses end-of-line characters and indents lines to format the XML. If {@code compact="true"}, then no
- * end-of-line or indentation is used. Message content may contain, of course, end-of-lines.
- * </p>
- * <h2>Additional Fields</h2>
- * <p>
- * This property allows addition of custom fields into generated JSON.
- * {@code <XmlLayout><KeyValuePair key="foo" value="bar"/></XmlLayout>} inserts {@code <foo>bar</foo>} directly into XML
- * output. Supports Lookup expressions.
- * </p>
- */
-@Configurable(elementType = Layout.ELEMENT_TYPE, printObject = true)
-@Plugin
-public final class XmlLayout extends AbstractJacksonLayout {
-
- public static class Builder<B extends Builder<B>> extends AbstractJacksonLayout.Builder<B>
- implements org.apache.logging.log4j.plugins.util.Builder<XmlLayout> {
-
- public Builder() {
- super();
- setCharset(StandardCharsets.UTF_8);
- }
-
- @Override
- public XmlLayout build() {
- return new XmlLayout(
- getConfiguration(),
- isLocationInfo(),
- isProperties(),
- isComplete(),
- isCompact(),
- getCharset(),
- isIncludeStacktrace(),
- isStacktraceAsString(),
- isIncludeNullDelimiter(),
- isIncludeNullDelimiter(),
- getAdditionalFields());
- }
- }
-
- @JacksonXmlRootElement(namespace = XmlConstants.XML_NAMESPACE, localName = XmlConstants.ELT_EVENT)
- public static class XmlLogEventWithAdditionalFields extends LogEventWithAdditionalFields {
-
- public XmlLogEventWithAdditionalFields(final LogEvent logEvent, final Map<String, String> additionalFields) {
- super(logEvent, additionalFields);
- }
-
- @Override
- @JsonSerialize(as = LogEvent.class)
- public LogEvent getLogEvent() {
- return super.getLogEvent();
- }
- }
-
- private static final String ROOT_TAG = "Events";
-
- /**
- * Creates an XML Layout using the default settings.
- *
- * @return an XML Layout.
- */
- public static XmlLayout createDefaultLayout() {
- return new XmlLayout(
- new DefaultConfiguration(),
- false,
- false,
- false,
- false,
- StandardCharsets.UTF_8,
- true,
- false,
- false,
- false,
- null);
- }
-
- @PluginFactory
- public static <B extends Builder<B>> B newBuilder() {
- return new Builder<B>().asBuilder();
- }
-
- private XmlLayout(
- final Configuration config,
- final boolean locationInfo,
- final boolean properties,
- final boolean complete,
- final boolean compact,
- final Charset charset,
- final boolean includeStacktrace,
- final boolean stacktraceAsString,
- final boolean includeNullDelimiter,
- final boolean includeTimeMillis,
- final KeyValuePair[] additionalFields) {
- super(
- config,
- new XmlJacksonFactory(includeStacktrace, stacktraceAsString)
- .newWriter(locationInfo, properties, compact, includeTimeMillis),
- charset,
- compact,
- complete,
- false,
- null,
- null,
- includeNullDelimiter,
- additionalFields);
- }
-
- @Override
- protected LogEventWithAdditionalFields createLogEventWithAdditionalFields(
- final LogEvent event, final Map<String, String> additionalFieldsMap) {
- return new XmlLogEventWithAdditionalFields(event, additionalFieldsMap);
- }
-
- /**
- * Gets this XmlLayout's content format. Specified by:
- * <ul>
- * <li>Key: "dtd" Value: "log4j-events.dtd"</li>
- * <li>Key: "version" Value: "2.0"</li>
- * </ul>
- *
- * @return Map of content format keys supporting XmlLayout
- */
- @Override
- public Map<String, String> getContentFormat() {
- final Map<String, String> result = new HashMap<>();
- // result.put("dtd", "log4j-events.dtd");
- result.put("xsd", "log4j-events.xsd");
- result.put("version", "2.0");
- return result;
- }
-
- /**
- * @return The content type.
- */
- @Override
- public String getContentType() {
- return "text/xml; charset=" + this.getCharset();
- }
-
- /**
- * Returns appropriate XML footer.
- *
- * @return a byte array containing the footer, closing the XML root element.
- */
- @Override
- public byte[] getFooter() {
- if (!complete) {
- return null;
- }
- return getBytes("</" + ROOT_TAG + '>' + this.eol);
- }
-
- /**
- * Returns appropriate XML headers.
- * <ol>
- * <li>XML processing instruction</li>
- * <li>XML root element</li>
- * </ol>
- *
- * @return a byte array containing the header.
- */
- @Override
- public byte[] getHeader() {
- if (!complete) {
- return null;
- }
- final StringBuilder buf = new StringBuilder();
- buf.append("<?xml version=\"1.0\" encoding=\"");
- buf.append(this.getCharset().name());
- buf.append("\"?>");
- buf.append(this.eol);
- // Make the log4j namespace the default namespace, no need to use more space with a namespace prefix.
- buf.append('<');
- buf.append(ROOT_TAG);
- buf.append(" xmlns=\"" + XmlConstants.XML_NAMESPACE + "\">");
- buf.append(this.eol);
- return buf.toString().getBytes(this.getCharset());
- }
-}
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/package-info.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/layout/package-info.java
deleted file mode 100644
index fe534f04e7..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/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.xml.layout;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/package-info.java b/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/package-info.java
deleted file mode 100644
index 0121a8077b..0000000000
--- a/log4j-layout-jackson-xml/src/main/java/org/apache/logging/log4j/jackson/xml/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.xml;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/LevelMixInXmlTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/LevelMixInXmlTest.java
deleted file mode 100644
index a3ee7bdd5b..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/LevelMixInXmlTest.java
+++ /dev/null
@@ -1,39 +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.xml;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import org.apache.logging.log4j.jackson.LevelMixInTest;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-public class LevelMixInXmlTest extends LevelMixInTest {
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jXmlObjectMapper();
- }
-
- @Test
- @Disabled("String-like objects like Level do not work as root elements.")
- @Override
- public void testNameOnly() throws IOException {
- // Disabled: see https://github.com/FasterXML/jackson-dataformat-xml
- super.testNameOnly();
- }
-}
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/MarkerMixInXmlTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/MarkerMixInXmlTest.java
deleted file mode 100644
index 1625af8a7b..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/MarkerMixInXmlTest.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.xml;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.logging.log4j.jackson.AbstractMarkerMixInTest;
-
-public class MarkerMixInXmlTest extends AbstractMarkerMixInTest {
-
- @Override
- protected ObjectMapper newObjectMapper() {
- return new Log4jXmlObjectMapper(true, false);
- }
-}
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixInTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixInTest.java
deleted file mode 100644
index 407d764b9f..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/StackTraceElementXmlMixInTest.java
+++ /dev/null
@@ -1,80 +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.xml;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import java.io.IOException;
-import org.apache.logging.log4j.core.test.categories.Layouts;
-import org.apache.logging.log4j.jackson.Log4jStackTraceElementDeserializer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-@Category(Layouts.Xml.class)
-public class StackTraceElementXmlMixInTest {
-
- protected String aposToQuotes(final String json) {
- return json.replace("'", "\"");
- }
-
- private void roundtrip(final ObjectMapper mapper)
- throws JsonProcessingException, IOException, JsonParseException, JsonMappingException {
- 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);
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testFromJsonWithLog4jModule() throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- final boolean encodeThreadContextAsList = false;
- final Log4jXmlModule module = new Log4jXmlModule(true, false);
- module.addDeserializer(StackTraceElement.class, new Log4jStackTraceElementDeserializer());
- mapper.registerModule(module);
- final StackTraceElement expected =
- new StackTraceElement("package.SomeClass", "someMethod", "SomeClass.java", 123);
- final String s = this.aposToQuotes(
- "{'class':'package.SomeClass','method':'someMethod','file':'SomeClass.java','line':123}");
- final StackTraceElement actual = mapper.readValue(s, StackTraceElement.class);
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testFromJsonWithSimpleModule() throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- 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 String s = this.aposToQuotes(
- "{'class':'package.SomeClass','method':'someMethod','file':'SomeClass.java','line':123}");
- final StackTraceElement actual = mapper.readValue(s, StackTraceElement.class);
- Assert.assertEquals(expected, actual);
- }
-
- @Test
- public void testLog4jXmlObjectMapper() throws Exception {
- this.roundtrip(new Log4jXmlObjectMapper());
- }
-}
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ConcurrentLoggingWithXmlLayoutTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ConcurrentLoggingWithXmlLayoutTest.java
deleted file mode 100644
index e438eddd07..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ConcurrentLoggingWithXmlLayoutTest.java
+++ /dev/null
@@ -1,115 +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.xml.layout;
-
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.startsWith;
-import static org.junit.Assert.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 org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
-import org.junit.AfterClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-
-/**
- * Like the test for LOG4J2-1769.
- */
-public class ConcurrentLoggingWithXmlLayoutTest {
-
- private 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);
- }
- }
- }
-
- @ClassRule
- public static LoggerContextRule context = new LoggerContextRule("log4j2-xml-layout.xml");
-
- private static final String PATH = "target/test-xml-layout.log";
-
- @AfterClass
- public static void after() {
- new File(PATH).delete();
- }
-
- @Test
- public void testConcurrentLogging() throws Throwable {
- final Logger log = context.getLogger(ConcurrentLoggingWithXmlLayoutTest.class);
- final Set<Thread> threads = Collections.synchronizedSet(new HashSet<Thread>());
- final List<Throwable> thrown = Collections.synchronizedList(new ArrayList<Throwable>());
-
- 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(new Thread.UncaughtExceptionHandler() {
- @Override
- public void uncaughtException(final Thread t, final Throwable e) {
- thrown.add(e);
- }
- });
- t.start();
- }
-
- while (!threads.isEmpty()) {
- log.info("not done going to sleep...");
- Thread.sleep(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());
- for (final String line : lines) {
- assertThat(line, startsWith("<Event "));
- assertThat(line, endsWith("</Event>"));
- }
- }
- }
-}
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ThrowableProxyXmlTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ThrowableProxyXmlTest.java
deleted file mode 100644
index d63ef6d884..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/ThrowableProxyXmlTest.java
+++ /dev/null
@@ -1,30 +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.xml.layout;
-
-import java.io.IOException;
-import org.apache.logging.log4j.jackson.ThrowableProxyJacksonTest;
-import org.apache.logging.log4j.jackson.xml.Log4jXmlObjectMapper;
-import org.junit.Test;
-
-public class ThrowableProxyXmlTest extends ThrowableProxyJacksonTest {
-
- @Test
- public void testIoContainerAsXml() throws IOException {
- testIoContainer(new Log4jXmlObjectMapper());
- }
-}
diff --git a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayoutTest.java b/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayoutTest.java
deleted file mode 100644
index 8624801e73..0000000000
--- a/log4j-layout-jackson-xml/src/test/java/org/apache/logging/log4j/jackson/xml/layout/XmlLayoutTest.java
+++ /dev/null
@@ -1,461 +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.xml.layout;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Map;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
-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.DefaultConfiguration;
-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.XmlConstants;
-import org.apache.logging.log4j.jackson.xml.AbstractLogEventXmlMixIn;
-import org.apache.logging.log4j.jackson.xml.Log4jXmlObjectMapper;
-import org.apache.logging.log4j.message.SimpleMessage;
-import org.apache.logging.log4j.spi.AbstractLogger;
-import org.apache.logging.log4j.test.junit.UsingAnyThreadContext;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-/**
- * Tests {@link XmlLayout}.
- */
-@UsingAnyThreadContext
-@ConfigurationFactoryType(BasicConfigurationFactory.class)
-public class XmlLayoutTest {
- private static final int NOT_FOUND = -1;
-
- @AfterAll
- public static void cleanupClass() {
- LoggerContext.getContext().stop();
- }
-
- LoggerContext ctx = LoggerContext.getContext();
-
- Logger rootLogger = this.ctx.getRootLogger();
-
- private void checkAttribute(final String name, final String value, final String str) {
- assertTrue(str.contains(name + "=\"" + value + "\""), str);
- }
-
- private void checkAttributeName(final String name, final String str) {
- assertTrue(str.contains(name + "=\""), str);
- }
-
- private void checkContains(final String expected, final List<String> list) {
- for (final String string : list) {
- final String trimedLine = string.trim();
- if (trimedLine.contains(expected)) {
- return;
- }
- }
- fail("Cannot find " + expected + " in " + list);
- }
-
- private void checkContextMapElement(final String key, final String value, final String str) {
- // <item key="MDC.A" value="A_Value"/>
- assertTrue(str.contains(String.format("<item key=\"%s\" value=\"%s\"/>", key, value)), str);
- }
-
- private void checkContextStackElement(final String value, final boolean compact, final String str) {
- // <ContextStackItem>stack_msg1</ContextStackItem>
- assertTrue(str.contains(String.format("<ContextStackItem>%s</ContextStackItem>", value)), str);
- }
-
- private void checkElementName(
- final String name, final String str, final boolean withAttributes, final boolean withChildren) {
- // simple checks, don't try to be too smart here, we're just looking for the names and basic shape.
- // start
- final String startStr = withAttributes ? "<" + name + " " : "<" + name + ">";
- final int startPos = str.indexOf(startStr);
- assertTrue(startPos >= 0, String.format("Missing text '%s' in: %s", startStr, str));
- // end
- final String endStr = withChildren ? "</" + name + ">" : "/>";
- final int endPos = str.indexOf(endStr, startPos + startStr.length());
- assertTrue(endPos >= 0, str);
- }
-
- private void checkElementNameAbsent(final String name, final boolean compact, final String str) {
- assertFalse(str.contains("<" + name));
- }
-
- private void checkJsonPropertyOrder(
- final boolean includeContextStack,
- final boolean includeContextMap,
- final boolean includeStacktrace,
- final String str) {
- final JsonPropertyOrder annotation = AbstractLogEventXmlMixIn.class.getAnnotation(JsonPropertyOrder.class);
- Assertions.assertNotNull(annotation);
- int previousIndex = 0;
- String previousName = null;
- for (final String name : annotation.value()) {
- final int currentIndex = str.indexOf(name);
- if (!includeContextStack && XmlConstants.ELT_CONTEXT_STACK.equals(name)) {
- assertEquals(NOT_FOUND, currentIndex, String.format("Unexpected element '%s' in: %s", name, str));
- break;
- }
- if (!includeContextMap && XmlConstants.ELT_CONTEXT_MAP.equals(name)) {
- assertEquals(NOT_FOUND, currentIndex, String.format("Unexpected element '%s' in: %s", name, str));
- break;
- }
- if (!includeStacktrace && XmlConstants.ELT_EXTENDED_STACK_TRACE.equals(name)) {
- assertEquals(NOT_FOUND, currentIndex, String.format("Unexpected element '%s' in: %s", name, str));
- break;
- }
- if (!includeStacktrace && XmlConstants.ELT_EXTENDED_STACK_TRACE_ITEM.equals(name)) {
- assertEquals(NOT_FOUND, currentIndex, String.format("Unexpected element '%s' in: %s", name, str));
- break;
- }
- // TODO
- // Bug: The method
- // com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._sortProperties(Map<String,
- // POJOPropertyBuilder>) messes up the order defined in AbstractXmlLogEventMixIn's JsonPropertyOrder
- // annotations.
- // Assert.assertTrue(String.format("name='%s', previousIndex=%,d, previousName='%s', currentIndex=%,d: %s",
- // name, previousIndex, previousName, currentIndex, str), previousIndex < currentIndex);
- previousIndex = currentIndex;
- previousName = name;
- }
- }
-
- private String prepareXMLForStacktraceTests(final boolean stacktraceAsString) {
- final Log4jLogEvent expected = LogEventFixtures.createLogEvent();
- // @formatter:off
- final AbstractJacksonLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setCompact(true)
- .setIncludeStacktrace(true)
- .setStacktraceAsString(stacktraceAsString)
- .build();
- // @formatter:off
- return layout.toSerializable(expected);
- }
-
- @Test
- public void testAdditionalFields() {
- final AbstractJacksonLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .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());
- assertTrue(str.contains("<KEY1>VALUE1</KEY1>"), str);
- assertTrue(str.contains("<KEY2>" + new JavaLookup().getRuntime() + "</KEY2>"), str);
- }
-
- @Test
- public void testMutableLogEvent() {
- final AbstractJacksonLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .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 includeLocationInfo,
- final boolean compact,
- final boolean includeContextMap,
- final boolean includeContextStack,
- final boolean includeStacktrace)
- throws Exception {
- final Log4jLogEvent expected = LogEventFixtures.createLogEvent();
- // @formatter:off
- final XmlLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setLocationInfo(includeLocationInfo)
- .setProperties(includeContextMap)
- .setComplete(false)
- .setCompact(compact)
- .setIncludeStacktrace(includeStacktrace)
- .setCharset(StandardCharsets.UTF_8)
- .build();
- final String str = layout.toSerializable(expected);
- // @formatter:on
- // System.out.println(str);
- assertEquals(!compact, str.contains("\n"), str);
- assertEquals(includeLocationInfo, str.contains("Source"), str);
- assertEquals(includeContextMap, str.contains("ContextMap"), str);
- final Log4jLogEvent actual = new Log4jXmlObjectMapper().readValue(str, Log4jLogEvent.class);
- LogEventFixtures.assertEqualLogEvents(
- expected, actual, includeLocationInfo, includeContextMap, includeStacktrace);
- if (includeContextMap) {
- this.checkContextMapElement("MDC.A", "A_Value", str);
- this.checkContextMapElement("MDC.B", "B_Value", str);
- }
- if (includeContextStack) {
- this.checkContextStackElement("stack_msg1", compact, str);
- this.checkContextStackElement("stack_msg2", compact, str);
- }
-
- //
- assertNull(actual.getThrown());
- // check some attrs
- assertTrue(str.contains("loggerFqcn=\"f.q.c.n\""), str);
- assertTrue(str.contains("loggerName=\"a.B\""), str);
- // make sure short names are used
- assertTrue(str.contains("<Event "), str);
- if (includeStacktrace) {
- assertTrue(str.contains("class="), "Missing \"class=\" in: " + str);
- assertTrue(str.contains("method="), "Missing \"method=\" in: " + str);
- assertTrue(str.contains("file="), "Missing \"file=\" in: " + str);
- assertTrue(str.contains("line="), "Missing \"line=\" in: " + str);
- }
- //
- // make sure the names we want are used
- // this.checkAttributeName("timeMillis", compact, str);
- this.checkElementName("Instant", str, true, false);
- this.checkAttributeName("epochSecond", str);
- this.checkAttributeName("nanoOfSecond", str);
- this.checkAttributeName("thread", str); // and not threadName
- this.checkAttributeName("level", str);
- this.checkAttributeName("loggerName", str);
- this.checkElementName("Marker", str, true, true);
- this.checkAttributeName("name", str);
- this.checkElementName("Parents", str, false, true);
- this.checkElementName("Message", str, false, true);
- this.checkElementName("Thrown", str, true, true);
- this.checkElementName("Cause", str, true, includeStacktrace);
- this.checkAttributeName("commonElementCount", str);
- this.checkAttributeName("message", str);
- this.checkAttributeName("localizedMessage", str);
- if (includeStacktrace) {
- this.checkElementName("ExtendedStackTrace", str, false, true);
- this.checkAttributeName("class", str);
- this.checkAttributeName("method", str);
- this.checkAttributeName("file", str);
- this.checkAttributeName("line", str);
- this.checkAttributeName("exact", str);
- this.checkAttributeName("location", str);
- this.checkAttributeName("version", str);
- } else {
- this.checkElementNameAbsent("ExtendedStackTrace", compact, str);
- }
- this.checkElementName("Suppressed", str, false, true);
- this.checkAttributeName("loggerFqcn", str);
- this.checkAttributeName("endOfBatch", str);
- if (includeContextMap) {
- this.checkElementName("ContextMap", str, false, true);
- } else {
- this.checkElementNameAbsent("ContextMap", compact, str);
- }
- this.checkElementName("ContextStack", str, false, true);
- if (includeLocationInfo) {
- this.checkElementName("Source", str, true, false);
- } else {
- this.checkElementNameAbsent("Source", compact, str);
- }
- // check some attrs
- this.checkAttribute("loggerFqcn", "f.q.c.n", str);
- this.checkAttribute("loggerName", "a.B", str);
- this.checkJsonPropertyOrder(includeContextStack, includeContextMap, includeStacktrace, str);
- }
-
- @Test
- public void testContentType() {
- final XmlLayout layout = XmlLayout.createDefaultLayout();
- assertEquals("text/xml; charset=UTF-8", layout.getContentType());
- }
-
- @Test
- public void testDefaultCharset() {
- final XmlLayout layout = XmlLayout.createDefaultLayout();
- assertEquals(StandardCharsets.UTF_8, layout.getCharset());
- }
-
- @Test
- public void testExcludeStacktrace() throws Exception {
- this.testAllFeatures(false, false, false, false, false);
- }
-
- @Test
- public void testIncludeNullDelimiterFalse() {
- final AbstractJacksonLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setCompact(true)
- .setIncludeNullDelimiter(false)
- .build();
- final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
- assertFalse(str.endsWith("\0"));
- }
-
- @Test
- public void testIncludeNullDelimiterTrue() {
- final AbstractJacksonLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setCompact(true)
- .setIncludeNullDelimiter(true)
- .build();
- final String str = layout.toSerializable(LogEventFixtures.createLogEvent());
- assertTrue(str.endsWith("\0"));
- }
-
- /**
- * Test case for MDC conversion pattern.
- */
- @Test
- public void testLayout() {
- final Map<String, Appender> appenders = this.rootLogger.getAppenders();
- for (final Appender appender : appenders.values()) {
- this.rootLogger.removeAppender(appender);
- }
- // set up appender
- final XmlLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setLocationInfo(true)
- .setProperties(true)
- .setComplete(true)
- .setCompact(false)
- .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"));
-
- final Marker marker = MarkerManager.getMarker("EVENT");
- this.rootLogger.error(marker, "marker test");
-
- appender.stop();
-
- final List<String> list = appender.getMessages();
-
- final String string = list.get(0);
- assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", string, "Incorrect header: " + string);
- assertEquals("</Events>", list.get(list.size() - 1), "Incorrect footer");
- this.checkContains("loggerFqcn=\"" + AbstractLogger.class.getName() + "\"", list);
- this.checkContains("level=\"DEBUG\"", list);
- this.checkContains(">starting mdc pattern test</Message>", list);
- // this.checkContains("<Message>starting mdc pattern test</Message>", list);
-
- // <Marker xmlns="" _class="org.apache.logging.log4j.MarkerManager..Log4jMarker" name="EVENT"/>
- this.checkContains("<Marker", list);
- this.checkContains("name=\"EVENT\"/>", list);
-
- for (final Appender app : appenders.values()) {
- this.rootLogger.addAppender(app);
- }
- }
-
- @Test
- public void testLayoutLoggerName() {
- final XmlLayout layout = XmlLayout.newBuilder()
- .setConfiguration(new DefaultConfiguration())
- .setLocationInfo(false)
- .setProperties(true)
- .setComplete(true)
- .setCompact(false)
- .setIncludeStacktrace(true)
- .build();
-
- final Log4jLogEvent event = 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(event);
- assertTrue(str.contains("loggerName=\"a.B\""), str);
- }
-
- @Test
- public void testLocationOffCompactOffMdcOff() throws Exception {
- this.testAllFeatures(false, false, false, false, true);
- }
-
- @Test
- public void testLocationOnCompactOnMdcOn() throws Exception {
- this.testAllFeatures(true, true, true, true, true);
- }
-
- @Test
- public void testLocationOnCompactOnNdcOn() throws Exception {
- this.testAllFeatures(false, false, false, true, false);
- }
-
- @Test
- public void testStacktraceAsNonString() {
- final String str = prepareXMLForStacktraceTests(false);
- assertTrue(str.contains("<ExtendedStackTrace><ExtendedStackTraceItem"), str);
- }
-
- @Test
- public void testStacktraceAsString() {
- final String str = prepareXMLForStacktraceTests(true);
- assertTrue(str.contains("<ExtendedStackTrace>java.lang.NullPointerException"), str);
- }
-}
diff --git a/log4j-layout-jackson/pom.xml b/log4j-layout-jackson/pom.xml
deleted file mode 100644
index 2f5131de25..0000000000
--- a/log4j-layout-jackson/pom.xml
+++ /dev/null
@@ -1,90 +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</artifactId>
- <name>Apache Log4j Layout for Jackson</name>
- <description>Apache Log4j Layout for Jackson.</description>
- <properties>
- <log4jParentDir>${basedir}/..</log4jParentDir>
-
- <!--
- ~ 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"
- </bnd-extra-module-options>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</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.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-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-test-jar</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonFactory.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonFactory.java
deleted file mode 100644
index 6031f39aca..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonFactory.java
+++ /dev/null
@@ -1,82 +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;
-
-import com.fasterxml.jackson.core.PrettyPrinter;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
-import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-
-public abstract class AbstractJacksonFactory {
-
- protected final boolean includeStacktrace;
-
- protected final boolean stacktraceAsString;
-
- public AbstractJacksonFactory(final boolean includeStacktrace, final boolean stacktraceAsString) {
- super();
- this.includeStacktrace = includeStacktrace;
- this.stacktraceAsString = stacktraceAsString;
- }
-
- protected abstract String getPropertyNameForContextMap();
-
- protected abstract String getPropertyNameForTimeMillis();
-
- protected abstract String getPropertyNameForInstant();
-
- protected abstract String getPropertyNameForNanoTime();
-
- protected abstract String getPropertyNameForSource();
-
- protected abstract String getPropertyNameForStackTrace();
-
- protected abstract PrettyPrinter newCompactPrinter();
-
- protected abstract ObjectMapper newObjectMapper();
-
- protected abstract PrettyPrinter newPrettyPrinter();
-
- public ObjectWriter newWriter(
- final boolean locationInfo, final boolean properties, final boolean compact, final boolean includeMillis) {
- final SimpleFilterProvider filters = new SimpleFilterProvider();
- final Set<String> except = new HashSet<>(5);
- if (!locationInfo) {
- except.add(this.getPropertyNameForSource());
- }
- if (!properties) {
- except.add(this.getPropertyNameForContextMap());
- }
- if (!includeStacktrace) {
- except.add(this.getPropertyNameForStackTrace());
- }
- if (includeMillis) {
- except.add(getPropertyNameForInstant());
- } else {
- except.add(getPropertyNameForTimeMillis());
- }
- except.add(this.getPropertyNameForNanoTime());
- filters.addFilter(Log4jLogEvent.class.getName(), SimpleBeanPropertyFilter.serializeAllExcept(except));
- final ObjectWriter writer =
- this.newObjectMapper().writer(compact ? this.newCompactPrinter() : this.newPrettyPrinter());
- return writer.with(filters);
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonLayout.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonLayout.java
deleted file mode 100644
index 4bf1ffc80b..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractJacksonLayout.java
+++ /dev/null
@@ -1,514 +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;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.core.layout.AbstractStringLayout;
-import org.apache.logging.log4j.core.lookup.StrSubstitutor;
-import org.apache.logging.log4j.core.time.Instant;
-import org.apache.logging.log4j.core.util.KeyValuePair;
-import org.apache.logging.log4j.core.util.StringBuilderWriter;
-import org.apache.logging.log4j.message.Message;
-import org.apache.logging.log4j.plugins.PluginBuilderAttribute;
-import org.apache.logging.log4j.plugins.PluginElement;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.util.Strings;
-
-public abstract class AbstractJacksonLayout extends AbstractStringLayout {
-
- public abstract static class Builder<B extends Builder<B>> extends AbstractStringLayout.Builder<B> {
-
- @PluginBuilderAttribute
- private boolean eventEol;
-
- @PluginBuilderAttribute
- private String endOfLine;
-
- @PluginBuilderAttribute
- private boolean compact;
-
- @PluginBuilderAttribute
- private boolean complete;
-
- @PluginBuilderAttribute
- private boolean locationInfo;
-
- @PluginBuilderAttribute
- private boolean properties;
-
- @PluginBuilderAttribute
- private boolean includeStacktrace = true;
-
- @PluginBuilderAttribute
- private boolean stacktraceAsString = false;
-
- @PluginBuilderAttribute
- private boolean includeNullDelimiter = false;
-
- @PluginBuilderAttribute
- private boolean includeTimeMillis = false;
-
- @PluginElement("AdditionalField")
- private KeyValuePair[] additionalFields;
-
- public KeyValuePair[] getAdditionalFields() {
- return additionalFields;
- }
-
- public boolean getEventEol() {
- return eventEol;
- }
-
- public String getEndOfLine() {
- return endOfLine;
- }
-
- public boolean isCompact() {
- return compact;
- }
-
- public boolean isComplete() {
- return complete;
- }
-
- public boolean isIncludeNullDelimiter() {
- return includeNullDelimiter;
- }
-
- public boolean isIncludeTimeMillis() {
- return includeTimeMillis;
- }
-
- /**
- * If "true", includes the stack trace of any Throwable in the generated data, defaults to "true".
- *
- * @return If "true", includes the stack trace of any Throwable in the generated data, defaults to "true".
- */
- public boolean isIncludeStacktrace() {
- return includeStacktrace;
- }
-
- public boolean isLocationInfo() {
- return locationInfo;
- }
-
- public boolean isProperties() {
- return properties;
- }
-
- public boolean isStacktraceAsString() {
- return stacktraceAsString;
- }
-
- /**
- * Additional fields to set on each log event.
- * @param additionalFields The additional Key/Value pairs to add.
- * @return this builder
- */
- public B setAdditionalFields(final KeyValuePair[] additionalFields) {
- this.additionalFields = additionalFields;
- return asBuilder();
- }
-
- public B setCompact(final boolean compact) {
- this.compact = compact;
- return asBuilder();
- }
-
- public B setComplete(final boolean complete) {
- this.complete = complete;
- return asBuilder();
- }
-
- public B setEventEol(final boolean eventEol) {
- this.eventEol = eventEol;
- return asBuilder();
- }
-
- public B setEndOfLine(final String endOfLine) {
- this.endOfLine = endOfLine;
- return asBuilder();
- }
-
- /**
- * Whether to include NULL byte as delimiter after each event (optional, default to false).
- * @param includeNullDelimiter true if a null delimiter should be included.
- * @return this builder
- */
- public B setIncludeNullDelimiter(final boolean includeNullDelimiter) {
- this.includeNullDelimiter = includeNullDelimiter;
- return asBuilder();
- }
-
- /**
- * Whether to include the timestamp (in addition to the Instant) (optional, default to false).
- *
- * @return this builder
- */
- public B setIncludeTimeMillis(final boolean includeTimeMillis) {
- this.includeTimeMillis = includeTimeMillis;
- return asBuilder();
- }
-
- /**
- * If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".
- *
- * @param includeStacktrace
- * If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".
- * @return this builder
- */
- public B setIncludeStacktrace(final boolean includeStacktrace) {
- this.includeStacktrace = includeStacktrace;
- return asBuilder();
- }
-
- public B setLocationInfo(final boolean locationInfo) {
- this.locationInfo = locationInfo;
- return asBuilder();
- }
-
- public B setProperties(final boolean properties) {
- this.properties = properties;
- return asBuilder();
- }
-
- /**
- * Whether to format the stacktrace as a string, and not a nested object (optional, defaults to false).
- * @param stacktraceAsString true if the stacktrace should be formatted as a String.
- * @return this builder
- */
- public B setStacktraceAsString(final boolean stacktraceAsString) {
- this.stacktraceAsString = stacktraceAsString;
- return asBuilder();
- }
-
- protected String toStringOrNull(final byte[] header) {
- return header == null ? null : new String(header, Charset.defaultCharset());
- }
- }
- /**
- * Subclasses can annotate with Jackson annotations for JSON example.
- */
- public static class LogEventWithAdditionalFields {
-
- private final LogEvent logEvent;
- private final Map<String, String> additionalFields;
-
- public LogEventWithAdditionalFields(final LogEvent logEvent, final Map<String, String> additionalFields) {
- this.logEvent = logEvent;
- this.additionalFields = additionalFields;
- }
-
- public Map<String, String> getAdditionalFields() {
- return additionalFields;
- }
-
- public LogEvent getLogEvent() {
- return logEvent;
- }
- }
-
- protected static class ResolvableKeyValuePair {
-
- final String key;
- final String value;
- final boolean valueNeedsLookup;
-
- ResolvableKeyValuePair(final KeyValuePair pair) {
- this.key = pair.getKey();
- this.value = pair.getValue();
- this.valueNeedsLookup = AbstractJacksonLayout.valueNeedsLookup(this.value);
- }
- }
-
- protected static final String DEFAULT_EOL = "\r\n";
- protected static final String COMPACT_EOL = Strings.EMPTY;
-
- private static ResolvableKeyValuePair[] prepareAdditionalFields(
- final Configuration config, final KeyValuePair[] additionalFields) {
- if (additionalFields == null || additionalFields.length == 0) {
- // No fields set
- return new ResolvableKeyValuePair[0];
- }
-
- // Convert to specific class which already determines whether values needs lookup during serialization
- final ResolvableKeyValuePair[] resolvableFields = new ResolvableKeyValuePair[additionalFields.length];
-
- for (int i = 0; i < additionalFields.length; i++) {
- final ResolvableKeyValuePair resolvable =
- resolvableFields[i] = new ResolvableKeyValuePair(additionalFields[i]);
-
- // Validate
- if (config == null && resolvable.valueNeedsLookup) {
- throw new IllegalArgumentException(
- "configuration needs to be set when there are additional fields with variables");
- }
- }
-
- return resolvableFields;
- }
-
- protected static boolean valueNeedsLookup(final String value) {
- return value != null && value.contains("${");
- }
-
- protected final String eol;
-
- protected final ObjectWriter objectWriter;
-
- protected final boolean compact;
-
- protected final boolean complete;
-
- protected final boolean includeNullDelimiter;
-
- protected final ResolvableKeyValuePair[] additionalFields;
-
- protected AbstractJacksonLayout(
- final Configuration config,
- final ObjectWriter objectWriter,
- final Charset charset,
- final boolean compact,
- final boolean complete,
- final boolean eventEol,
- final Serializer headerSerializer,
- final Serializer footerSerializer,
- final boolean includeNullDelimiter,
- final KeyValuePair[] additionalFields) {
- this(
- config,
- objectWriter,
- charset,
- compact,
- complete,
- eventEol,
- null,
- headerSerializer,
- footerSerializer,
- includeNullDelimiter,
- additionalFields);
- }
-
- protected AbstractJacksonLayout(
- final Configuration config,
- final ObjectWriter objectWriter,
- final Charset charset,
- final boolean compact,
- final boolean complete,
- final boolean eventEol,
- final String endOfLine,
- final Serializer headerSerializer,
- final Serializer footerSerializer,
- final boolean includeNullDelimiter,
- final KeyValuePair[] additionalFields) {
- super(config, charset, headerSerializer, footerSerializer);
- this.objectWriter = objectWriter;
- this.compact = compact;
- this.complete = complete;
- this.eol = endOfLine != null ? endOfLine : compact && !eventEol ? COMPACT_EOL : DEFAULT_EOL;
- this.includeNullDelimiter = includeNullDelimiter;
- this.additionalFields = prepareAdditionalFields(config, additionalFields);
- }
-
- protected LogEventWithAdditionalFields createLogEventWithAdditionalFields(
- final LogEvent event, final Map<String, String> additionalFieldsMap) {
- return new LogEventWithAdditionalFields(event, additionalFieldsMap);
- }
-
- private Map<String, String> resolveAdditionalFields(final LogEvent logEvent) {
- // Note: LinkedHashMap retains order
- final Map<String, String> additionalFieldsMap = new LinkedHashMap<>(additionalFields.length);
- final StrSubstitutor strSubstitutor = configuration.getStrSubstitutor();
-
- // Go over each field
- for (final ResolvableKeyValuePair pair : additionalFields) {
- if (pair.valueNeedsLookup) {
- // Resolve value
- additionalFieldsMap.put(pair.key, strSubstitutor.replace(logEvent, pair.value));
- } else {
- // Plain text value
- additionalFieldsMap.put(pair.key, pair.value);
- }
- }
-
- return additionalFieldsMap;
- }
-
- /**
- * Formats a {@link org.apache.logging.log4j.core.LogEvent}.
- *
- * @param event The LogEvent.
- * @return The XML representation of the LogEvent.
- */
- @Override
- public String toSerializable(final LogEvent event) {
- try (final StringBuilderWriter writer = new StringBuilderWriter()) {
- toSerializable(event, writer);
- return writer.toString();
- } catch (final IOException e) {
- // Should this be an ISE or IAE?
- LOGGER.error(e);
- return Strings.EMPTY;
- }
- }
-
- public void toSerializable(final LogEvent event, final Writer writer) throws IOException {
- objectWriter.writeValue(writer, wrapLogEvent(event));
- writer.write(eol);
- if (includeNullDelimiter) {
- writer.write('\0');
- }
- markEvent();
- }
-
- protected Object wrapLogEvent(final LogEvent event) {
- if (additionalFields.length > 0) {
- // Construct map for serialization - note that we are intentionally using original LogEvent
- final Map<String, String> additionalFieldsMap = resolveAdditionalFields(event);
- // This class combines LogEvent with AdditionalFields during serialization
- return createLogEventWithAdditionalFields(event, additionalFieldsMap);
- } else if (event instanceof Message) {
- // If the LogEvent implements the Message interface Jackson will not treat is as a LogEvent.
- return new ReadOnlyLogEventWrapper(event);
- // No additional fields, return original object
- }
- return event;
- }
-
- private static class ReadOnlyLogEventWrapper implements LogEvent {
-
- @JsonIgnore
- private final LogEvent event;
-
- public ReadOnlyLogEventWrapper(final LogEvent event) {
- this.event = event;
- }
-
- @Override
- public LogEvent toImmutable() {
- return event.toImmutable();
- }
-
- @Override
- public ReadOnlyStringMap getContextData() {
- return event.getContextData();
- }
-
- @Override
- public ThreadContext.ContextStack getContextStack() {
- return event.getContextStack();
- }
-
- @Override
- public String getLoggerFqcn() {
- return event.getLoggerFqcn();
- }
-
- @Override
- public Level getLevel() {
- return event.getLevel();
- }
-
- @Override
- public String getLoggerName() {
- return event.getLoggerName();
- }
-
- @Override
- public Marker getMarker() {
- return event.getMarker();
- }
-
- @Override
- public Message getMessage() {
- return event.getMessage();
- }
-
- @Override
- public long getTimeMillis() {
- return event.getTimeMillis();
- }
-
- @Override
- public Instant getInstant() {
- return event.getInstant();
- }
-
- @Override
- public StackTraceElement getSource() {
- return event.getSource();
- }
-
- @Override
- public String getThreadName() {
- return event.getThreadName();
- }
-
- @Override
- public long getThreadId() {
- return event.getThreadId();
- }
-
- @Override
- public int getThreadPriority() {
- return event.getThreadPriority();
- }
-
- @Override
- public Throwable getThrown() {
- return event.getThrown();
- }
-
- @Override
- public ThrowableProxy getThrownProxy() {
- return event.getThrownProxy();
- }
-
- @Override
- public boolean isEndOfBatch() {
- return event.isEndOfBatch();
- }
-
- @Override
- public boolean isIncludeLocation() {
- return event.isIncludeLocation();
- }
-
- @Override
- public void setEndOfBatch(final boolean endOfBatch) {}
-
- @Override
- public void setIncludeLocation(final boolean locationRequired) {}
-
- @Override
- public long getNanoTime() {
- return event.getNanoTime();
- }
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractLogEventMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractLogEventMixIn.java
deleted file mode 100644
index c17f4979dd..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/AbstractLogEventMixIn.java
+++ /dev/null
@@ -1,73 +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;
-
-import com.fasterxml.jackson.annotation.JsonFilter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.message.Message;
-
-/**
- * <pre>
- * AbstractLogEventMixIn
- *├─ AbstractLogEventXmlMixIn
- *├──── LogEventWithContextListXmlMixIn
- *├──── LogEventWithContextMapXmlMixIn
- *├─ AbstractLogEventJsonMixIn
- *├──── LogEventWithContextListJsonMixIn
- *├──── LogEventWithContextMapJsonMixIn
- * </pre>
- */
-@JsonFilter(AbstractLogEventMixIn.JSON_FILTER_ID)
-public abstract class AbstractLogEventMixIn implements LogEvent {
-
- public static final String ATTR_END_OF_BATCH = "endOfBatch";
- public static final String ATTR_LEVEL = "level";
- public static final String ATTR_LOGGER_FQCN = "loggerFqcn";
- public static final String ATTR_LOGGER_NAME = "loggerName";
- public static final String ATTR_MARKER = "marker";
- public static final String ATTR_THREAD = "thread";
- public static final String ATTR_THREAD_ID = "threadId";
- public static final String ATTR_THREAD_PRIORITY = "threadPriority";
- public static final String ELT_MESSAGE = "message";
- public static final String JSON_FILTER_ID = "org.apache.logging.log4j.core.impl.Log4jLogEvent";
-
- @JsonSerialize(using = MessageSerializer.class)
- @JsonDeserialize(using = SimpleMessageDeserializer.class)
- @Override
- public abstract Message getMessage();
-
- @JsonIgnore
- @Override
- public abstract Throwable getThrown();
-
- @JsonIgnore // ignore from 2.11.0
- @Override
- public abstract long getTimeMillis();
-
- @JsonIgnore
- @Override
- public abstract boolean isIncludeLocation();
-
- @Override
- public abstract void setEndOfBatch(boolean endOfBatch);
-
- @Override
- public abstract void setIncludeLocation(boolean locationRequired);
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListDeserializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListDeserializer.java
deleted file mode 100644
index 4d4fd58197..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListDeserializer.java
+++ /dev/null
@@ -1,56 +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;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import org.apache.logging.log4j.core.impl.ContextDataFactory;
-import org.apache.logging.log4j.util.StringMap;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class ContextDataAsEntryListDeserializer extends StdDeserializer<StringMap> {
-
- private static final long serialVersionUID = 1L;
-
- ContextDataAsEntryListDeserializer() {
- super(Map.class);
- }
-
- @Override
- public StringMap deserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- final List<MapEntry> list = jp.readValueAs(
- new TypeReference<List<MapEntry>>() {
- // do nothing
- });
- final StringMap contextData = ContextDataFactory.createContextData();
- for (final MapEntry mapEntry : list) {
- contextData.putValue(mapEntry.getKey(), mapEntry.getValue());
- }
- return contextData;
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListSerializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListSerializer.java
deleted file mode 100644
index 56501deeb6..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataAsEntryListSerializer.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;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.logging.log4j.util.BiConsumer;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class ContextDataAsEntryListSerializer extends StdSerializer<ReadOnlyStringMap> {
-
- private static final long serialVersionUID = 1L;
-
- protected ContextDataAsEntryListSerializer() {
- super(Map.class, false);
- }
-
- protected MapEntry createMapEntry(final String key, final String value) {
- return new MapEntry(key, value);
- }
-
- protected MapEntry[] createMapEntryArray(final int size) {
- return new MapEntry[size];
- }
-
- @Override
- public void serialize(
- final ReadOnlyStringMap contextData, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonGenerationException {
-
- final MapEntry[] pairs = createMapEntryArray(contextData.size());
- contextData.forEach(new BiConsumer<String, Object>() {
- int i = 0;
-
- @Override
- public void accept(final String key, final Object value) {
- pairs[i++] = createMapEntry(key, String.valueOf(value));
- }
- });
- jgen.writeObject(pairs);
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataDeserializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataDeserializer.java
deleted file mode 100644
index b202e3d839..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataDeserializer.java
+++ /dev/null
@@ -1,62 +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;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.logging.log4j.core.impl.ContextDataFactory;
-import org.apache.logging.log4j.util.StringMap;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class ContextDataDeserializer extends StdDeserializer<StringMap> {
-
- private static final long serialVersionUID = 1L;
-
- ContextDataDeserializer() {
- super(Map.class);
- }
-
- @Override
- public StringMap deserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- // Sanity check: verify that we got "Json Object":
- // JsonToken tok = jp.nextToken();
- // if (tok != JsonToken.START_OBJECT) {
- // throw new IOException("Expected data to start with an Object");
- // }
- final StringMap contextData = ContextDataFactory.createContextData();
- // Iterate over object fields:
- while (jp.nextToken() != JsonToken.END_OBJECT) {
- final String fieldName = jp.getCurrentName();
-
- // move to value
- jp.nextToken();
- contextData.putValue(fieldName, jp.getText());
- }
- return contextData;
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataSerializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataSerializer.java
deleted file mode 100644
index a294ceae73..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ContextDataSerializer.java
+++ /dev/null
@@ -1,63 +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;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-import java.io.IOException;
-import java.util.Map;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-import org.apache.logging.log4j.util.TriConsumer;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class ContextDataSerializer extends StdSerializer<ReadOnlyStringMap> {
-
- private static final long serialVersionUID = 1L;
-
- private static final TriConsumer<String, Object, JsonGenerator> WRITE_STRING_FIELD_INTO =
- (key, value, jsonGenerator) -> {
- try {
- if (value == null) {
- jsonGenerator.writeNullField(key);
- } else {
- jsonGenerator.writeStringField(key, String.valueOf(value));
- }
- } catch (final Exception ex) {
- throw new IllegalStateException("Problem with key " + key, ex);
- }
- };
-
- protected ContextDataSerializer() {
- super(Map.class, false);
- }
-
- @Override
- public void serialize(
- final ReadOnlyStringMap contextData, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonGenerationException {
-
- jgen.writeStartObject();
- contextData.forEach(WRITE_STRING_FIELD_INTO, jgen);
- jgen.writeEndObject();
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ExtendedStackTraceElementMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ExtendedStackTraceElementMixIn.java
deleted file mode 100644
index 7f47665feb..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ExtendedStackTraceElementMixIn.java
+++ /dev/null
@@ -1,112 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.logging.log4j.core.impl.ExtendedClassInfo;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-
-/**
- * Mix-in for {@link ExtendedStackTraceElement}.
- */
-@JsonPropertyOrder({
- // @formatter:off
- ExtendedStackTraceElementMixIn.ATTR_CLASS_LOADER_NAME,
- ExtendedStackTraceElementMixIn.ATTR_MODULE,
- ExtendedStackTraceElementMixIn.ATTR_MODULE_VERSION,
- ExtendedStackTraceElementMixIn.ATTR_CLASS,
- ExtendedStackTraceElementMixIn.ATTR_METHOD,
- ExtendedStackTraceElementMixIn.ATTR_FILE,
- ExtendedStackTraceElementMixIn.ATTR_LINE,
- ExtendedStackTraceElementMixIn.ATTR_EXACT,
- ExtendedStackTraceElementMixIn.ATTR_LOCATION,
- ExtendedStackTraceElementMixIn.ATTR_VERSION
- // @formatter:on
-})
-public abstract class ExtendedStackTraceElementMixIn {
-
- protected static final String ATTR_CLASS_LOADER_NAME = StackTraceElementConstants.ATTR_CLASS_LOADER_NAME;
- protected static final String ATTR_MODULE = StackTraceElementConstants.ATTR_MODULE;
- protected static final String ATTR_MODULE_VERSION = StackTraceElementConstants.ATTR_MODULE_VERSION;
- protected static final String ATTR_CLASS = StackTraceElementConstants.ATTR_CLASS;
- protected static final String ATTR_METHOD = StackTraceElementConstants.ATTR_METHOD;
- protected static final String ATTR_FILE = StackTraceElementConstants.ATTR_FILE;
- protected static final String ATTR_LINE = StackTraceElementConstants.ATTR_LINE;
- protected static final String ATTR_EXACT = "exact";
- protected static final String ATTR_LOCATION = "location";
- protected static final String ATTR_VERSION = "version";
-
- @JsonCreator
- public ExtendedStackTraceElementMixIn(
- // @formatter:off
- @JsonProperty(ATTR_CLASS_LOADER_NAME) final String classLoaderName,
- @JsonProperty(ATTR_MODULE) final String moduleName,
- @JsonProperty(ATTR_MODULE_VERSION) final String moduleVersion,
- @JsonProperty(ATTR_CLASS) final String declaringClass,
- @JsonProperty(ATTR_METHOD) final String methodName,
- @JsonProperty(ATTR_FILE) final String fileName,
- @JsonProperty(ATTR_LINE) final int lineNumber,
- @JsonProperty(ATTR_EXACT) final boolean exact,
- @JsonProperty(ATTR_LOCATION) final String location,
- @JsonProperty(ATTR_VERSION) final String version
- // @formatter:on
- ) {
- // empty
- }
-
- @JsonProperty(ATTR_CLASS_LOADER_NAME)
- public abstract String getClassLoaderName();
-
- @JsonProperty(ATTR_MODULE)
- public abstract String getModuleName();
-
- @JsonProperty(ATTR_MODULE_VERSION)
- public abstract String getModuleVersion();
-
- @JsonProperty(ATTR_CLASS)
- public abstract String getClassName();
-
- @JsonProperty(ATTR_EXACT)
- public abstract boolean getExact();
-
- @JsonIgnore
- public abstract ExtendedClassInfo getExtraClassInfo();
-
- @JsonProperty(ATTR_FILE)
- public abstract String getFileName();
-
- @JsonProperty(ATTR_LINE)
- public abstract int getLineNumber();
-
- @JsonProperty(ATTR_LOCATION)
- public abstract String getLocation();
-
- @JsonProperty(ATTR_METHOD)
- public abstract String getMethodName();
-
- @JsonIgnore
- abstract StackTraceElement getStackTraceElement();
-
- @JsonProperty(ATTR_VERSION)
- public abstract String getVersion();
-
- @JsonIgnore
- public abstract boolean isNativeMethod();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/InstantMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/InstantMixIn.java
deleted file mode 100644
index a01a0e6c28..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/InstantMixIn.java
+++ /dev/null
@@ -1,54 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.core.time.Instant;
-
-/**
- * Jackson mix-in for {@link Instant}.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- *
- * @see Marker
- */
-@JsonIgnoreProperties({"epochMillisecond", "nanoOfMillisecond"})
-public abstract class InstantMixIn {
-
- protected static final String ATTR_NANO_OF_SECOND = "nanoOfSecond";
- protected static final String ATTR_EPOCH_SECOND = "epochSecond";
-
- @JsonCreator
- protected InstantMixIn(
- // @formatter:off
- @JsonProperty(ATTR_EPOCH_SECOND) final long epochSecond,
- @JsonProperty(ATTR_NANO_OF_SECOND) final int nanoOfSecond)
- // @formatter:on
- {
- // empty
- }
-
- @JsonProperty(ATTR_EPOCH_SECOND)
- public abstract long getEpochSecond();
-
- @JsonProperty(ATTR_NANO_OF_SECOND)
- public abstract int getNanoOfSecond();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/JsonConstants.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/JsonConstants.java
deleted file mode 100644
index 682217d1d1..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/JsonConstants.java
+++ /dev/null
@@ -1,37 +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;
-
-/**
- * Keeps constants separate from any class that may depend on third party jars.
- */
-public final class JsonConstants {
- public static final String ELT_CAUSE = "cause";
- public static final String ELT_EVENT = "event";
- public static final String ELT_CONTEXT_MAP = "contextMap";
- public static final String ELT_CONTEXT_STACK = "contextStack";
- public static final String ELT_MARKER = "marker";
- public static final String ELT_PARENTS = "parents";
- public static final String ELT_SOURCE = "source";
- public static final String ELT_SUPPRESSED = "suppressed";
- public static final String ELT_THROWN = "thrown";
- public static final String ELT_MESSAGE = "message";
- public static final String ELT_EXTENDED_STACK_TRACE = "extendedStackTrace";
- public static final String ELT_NANO_TIME = "nanoTime";
- public static final String ELT_INSTANT = "instant";
- public static final String ELT_TIME_MILLIS = "timeMillis";
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LevelMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LevelMixIn.java
deleted file mode 100644
index 9cb5d7a52a..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LevelMixIn.java
+++ /dev/null
@@ -1,42 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonValue;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-
-/**
- * Jackson mix-in for {@link Level}.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- * @see Marker
- */
-@JsonIgnoreProperties({"name", "declaringClass", "standardLevel"})
-public abstract class LevelMixIn {
-
- @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
- public static Level getLevel(final String name) {
- return null;
- }
-
- @JsonValue
- public abstract String name();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/Log4jStackTraceElementDeserializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/Log4jStackTraceElementDeserializer.java
deleted file mode 100644
index 05913cc082..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/Log4jStackTraceElementDeserializer.java
+++ /dev/null
@@ -1,114 +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;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;
-import com.fasterxml.jackson.databind.util.ClassUtil;
-import java.io.IOException;
-
-/**
- * Copy and edit the Jackson (Apache License 2.0) class to use Log4j attribute names. Does not work as of Jackson 2.3.2.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public final class Log4jStackTraceElementDeserializer extends StdScalarDeserializer<StackTraceElement> {
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructs a new initialized instance.
- */
- public Log4jStackTraceElementDeserializer() {
- super(StackTraceElement.class);
- }
-
- @Override
- public StackTraceElement deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
- JsonToken t = jp.getCurrentToken();
- // Must get an Object
- if (t == JsonToken.START_OBJECT) {
- String classLoaderName = null,
- moduleName = null,
- moduleVersion = null,
- className = null,
- methodName = null,
- fileName = null;
- int lineNumber = -1;
-
- while ((t = jp.nextValue()) != JsonToken.END_OBJECT) {
- final String propName = jp.getCurrentName();
- switch (propName) {
- case "class": {
- className = jp.getText();
- break;
- }
- case "file": {
- fileName = jp.getText();
- break;
- }
- case "line": {
- if (t.isNumeric()) {
- lineNumber = jp.getIntValue();
- } else {
- // An XML number always comes in a string since there is no syntax help as with JSON.
- try {
- lineNumber = Integer.parseInt(jp.getText().trim());
- } catch (final NumberFormatException e) {
- throw JsonMappingException.from(
- jp, "Non-numeric token (" + t + ") for property 'line'", e);
- }
- }
- break;
- }
- case "method": {
- methodName = jp.getText();
- break;
- }
- case "nativeMethod": {
- // no setter, not passed via constructor: ignore
- break;
- }
- case "classLoaderName": {
- classLoaderName = jp.getText();
- break;
- }
- case "moduleName": {
- moduleName = jp.getText();
- break;
- }
- case "moduleVersion": {
- moduleVersion = jp.getText();
- break;
- }
- default: {
- this.handleUnknownProperty(jp, ctxt, this._valueClass, propName);
- }
- }
- }
- return new StackTraceElement(
- classLoaderName, moduleName, moduleVersion, className, methodName, fileName, lineNumber);
- }
- throw JsonMappingException.from(
- jp,
- String.format(
- "Cannot deserialize instance of %s out of %s token", ClassUtil.nameOf(this._valueClass), t));
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LogEventWithContextListMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LogEventWithContextListMixIn.java
deleted file mode 100644
index 3097a22e01..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/LogEventWithContextListMixIn.java
+++ /dev/null
@@ -1,133 +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;
-
-import com.fasterxml.jackson.annotation.JsonFilter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import org.apache.logging.log4j.Level;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.ThreadContext.ContextStack;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-import org.apache.logging.log4j.core.time.Instant;
-import org.apache.logging.log4j.message.Message;
-import org.apache.logging.log4j.util.ReadOnlyStringMap;
-
-@JsonRootName(XmlConstants.ELT_EVENT)
-@JsonFilter("org.apache.logging.log4j.core.impl.Log4jLogEvent")
-@JsonPropertyOrder({
- "timeMillis",
- XmlConstants.ELT_INSTANT,
- "threadName",
- "level",
- "loggerName",
- "marker",
- "message",
- "thrown",
- XmlConstants.ELT_CONTEXT_MAP,
- JsonConstants.ELT_CONTEXT_STACK,
- "loggerFQCN",
- "Source",
- "endOfBatch"
-})
-abstract class LogEventWithContextListMixIn implements LogEvent {
-
- @JsonProperty(JsonConstants.ELT_CONTEXT_MAP)
- @JsonSerialize(using = ContextDataAsEntryListSerializer.class)
- @JsonDeserialize(using = ContextDataAsEntryListDeserializer.class)
- // @JsonIgnore
- @Override
- public abstract ReadOnlyStringMap getContextData();
-
- @JsonProperty(JsonConstants.ELT_CONTEXT_STACK)
- @Override
- public abstract ContextStack getContextStack();
-
- @JsonProperty(JsonConstants.ELT_INSTANT)
- @Override
- public abstract Instant getInstant();
-
- @JsonProperty()
- @Override
- public abstract Level getLevel();
-
- @JsonProperty()
- @Override
- public abstract String getLoggerFqcn();
-
- @JsonProperty()
- @Override
- public abstract String getLoggerName();
-
- @JsonProperty(JsonConstants.ELT_MARKER)
- @Override
- public abstract Marker getMarker();
-
- @JsonProperty(JsonConstants.ELT_MESSAGE)
- @JsonSerialize(using = MessageSerializer.class)
- @JsonDeserialize(using = SimpleMessageDeserializer.class)
- @Override
- public abstract Message getMessage();
-
- @JsonProperty(JsonConstants.ELT_SOURCE)
- @JsonDeserialize(using = Log4jStackTraceElementDeserializer.class)
- @Override
- public abstract StackTraceElement getSource();
-
- @Override
- @JsonProperty("threadId")
- public abstract long getThreadId();
-
- @Override
- @JsonProperty("thread")
- public abstract String getThreadName();
-
- @Override
- @JsonProperty("threadPriority")
- public abstract int getThreadPriority();
-
- @JsonIgnore
- @Override
- public abstract Throwable getThrown();
-
- @JsonProperty(JsonConstants.ELT_THROWN)
- @Override
- public abstract ThrowableProxy getThrownProxy();
-
- @JsonProperty(value = JsonConstants.ELT_TIME_MILLIS, access = JsonProperty.Access.READ_ONLY)
- @Override
- public abstract long getTimeMillis();
-
- @JsonProperty()
- @Override
- public abstract boolean isEndOfBatch();
-
- @JsonIgnore
- @Override
- public abstract boolean isIncludeLocation();
-
- @Override
- public abstract void setEndOfBatch(boolean endOfBatch);
-
- @Override
- public abstract void setIncludeLocation(boolean locationRequired);
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MapEntry.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MapEntry.java
deleted file mode 100644
index 69395acc3d..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MapEntry.java
+++ /dev/null
@@ -1,108 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.logging.log4j.util.Strings;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- * <p>
- * Used to represent map entries in a generic fashion because the default Jackson behavior uses the key as the element
- * tag. Using the key as an element/property name would mean that you cannot have a generic JSON/XML schema for all log
- * event.
- * </p>
- */
-@JsonPropertyOrder({"key", "value"})
-public class MapEntry {
-
- @JsonProperty
- private String key;
-
- @JsonProperty
- private String value;
-
- @JsonCreator
- public MapEntry(@JsonProperty("key") final String key, @JsonProperty("value") final String value) {
- this.setKey(key);
- this.setValue(value);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof MapEntry)) {
- return false;
- }
- final MapEntry other = (MapEntry) obj;
- if (this.getKey() == null) {
- if (other.getKey() != null) {
- return false;
- }
- } else if (!this.getKey().equals(other.getKey())) {
- return false;
- }
- if (this.getValue() == null) {
- if (other.getValue() != null) {
- return false;
- }
- } else if (!this.getValue().equals(other.getValue())) {
- return false;
- }
- return true;
- }
-
- public String getKey() {
- return this.key;
- }
-
- public String getValue() {
- return this.value;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((this.getKey() == null) ? 0 : this.getKey().hashCode());
- result = prime * result
- + ((this.getValue() == null) ? 0 : this.getValue().hashCode());
- return result;
- }
-
- public void setKey(final String key) {
- this.key = key;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return Strings.EMPTY + this.getKey() + "=" + this.getValue();
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MarkerMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MarkerMixIn.java
deleted file mode 100644
index 205ab6de5c..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MarkerMixIn.java
+++ /dev/null
@@ -1,68 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.logging.log4j.Marker;
-
-/**
- * Jackson mix-in for {@link Marker}.
- * <p>
- * If we want to deal with more than one {@link Marker} implementation then recode these annotations to include metadata.
- * </p>
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- * <p>
- * Example XML:
- * </p>
- * <pre>
- * <Marker name="Marker1">
- * <Parents>
- * <Marker name="ParentMarker1">
- * <Parents>
- * <Marker name="GrandMotherMarker"/>
- * <Marker name="GrandFatherMarker"/>
- * </Parents>
- * </Marker>
- * <Marker name="ParentMarker2"/>
- * </Parents>
- * </Marker>
- * </pre>
- *
- * @see Marker
- */
-// Alternate for multiple Marker implementation.
-// @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-@JsonDeserialize(as = org.apache.logging.log4j.MarkerManager.Log4jMarker.class)
-public abstract class MarkerMixIn implements Marker {
-
- @JsonCreator
- public MarkerMixIn(@JsonProperty("name") final String name) {
- // empty
- }
-
- @Override
- @JsonProperty("name")
- public abstract String getName();
-
- @Override
- @JsonProperty(JsonConstants.ELT_PARENTS)
- public abstract Marker[] getParents();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MessageSerializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MessageSerializer.java
deleted file mode 100644
index 7dc9913b95..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MessageSerializer.java
+++ /dev/null
@@ -1,44 +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;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
-import java.io.IOException;
-import org.apache.logging.log4j.message.Message;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public final class MessageSerializer extends StdScalarSerializer<Message> {
-
- private static final long serialVersionUID = 1L;
-
- public MessageSerializer() {
- super(Message.class);
- }
-
- @Override
- public void serialize(final Message value, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonGenerationException {
- jgen.writeString(value.getFormattedMessage());
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MutableThreadContextStackDeserializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MutableThreadContextStackDeserializer.java
deleted file mode 100644
index 0d3551e01c..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/MutableThreadContextStackDeserializer.java
+++ /dev/null
@@ -1,50 +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;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import java.io.IOException;
-import java.util.List;
-import org.apache.logging.log4j.spi.MutableThreadContextStack;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-final class MutableThreadContextStackDeserializer extends StdDeserializer<MutableThreadContextStack> {
-
- private static final long serialVersionUID = 1L;
-
- MutableThreadContextStackDeserializer() {
- super(MutableThreadContextStack.class);
- }
-
- @Override
- public MutableThreadContextStack deserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
- final List<String> list = jp.readValueAs(
- new TypeReference<List<String>>() {
- // empty
- });
- return new MutableThreadContextStack(list);
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ObjectMessageSerializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ObjectMessageSerializer.java
deleted file mode 100644
index 5c38ee35c0..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ObjectMessageSerializer.java
+++ /dev/null
@@ -1,45 +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;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
-import java.io.IOException;
-import org.apache.logging.log4j.message.ObjectMessage;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-final class ObjectMessageSerializer extends StdScalarSerializer<ObjectMessage> {
-
- private static final long serialVersionUID = 1L;
-
- ObjectMessageSerializer() {
- super(ObjectMessage.class);
- }
-
- @Override
- public void serialize(
- final ObjectMessage value, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
- throws IOException, JsonGenerationException {
- jsonGenerator.writeObject(value.getParameter());
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleMessageDeserializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleMessageDeserializer.java
deleted file mode 100644
index df429f9007..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleMessageDeserializer.java
+++ /dev/null
@@ -1,44 +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;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;
-import java.io.IOException;
-import org.apache.logging.log4j.message.SimpleMessage;
-
-/**
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public final class SimpleMessageDeserializer extends StdScalarDeserializer<SimpleMessage> {
-
- private static final long serialVersionUID = 1L;
-
- SimpleMessageDeserializer() {
- super(SimpleMessage.class);
- }
-
- @Override
- public SimpleMessage deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext)
- throws IOException, JsonProcessingException {
- return new SimpleMessage(jsonParser.getValueAsString());
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleModuleInitializer.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleModuleInitializer.java
deleted file mode 100644
index c859fbfa08..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/SimpleModuleInitializer.java
+++ /dev/null
@@ -1,41 +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;
-
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import org.apache.logging.log4j.ThreadContext.ContextStack;
-import org.apache.logging.log4j.message.Message;
-import org.apache.logging.log4j.message.ObjectMessage;
-
-/**
- * Used to set up {@link SimpleModule} from different {@link SimpleModule} subclasses.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- */
-public class SimpleModuleInitializer {
- public void initialize(final SimpleModule simpleModule, final boolean objectMessageAsJsonObject) {
- // Workaround because mix-ins do not work for classes that already have a built-in deserializer.
- // See Jackson issue 429.
- simpleModule.addDeserializer(StackTraceElement.class, new Log4jStackTraceElementDeserializer());
- simpleModule.addDeserializer(ContextStack.class, new MutableThreadContextStackDeserializer());
- if (objectMessageAsJsonObject) {
- simpleModule.addSerializer(ObjectMessage.class, new ObjectMessageSerializer());
- }
- simpleModule.addSerializer(Message.class, new MessageSerializer());
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementConstants.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementConstants.java
deleted file mode 100644
index d0001e7d15..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementConstants.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;
-
-/**
- * Defines constants use for naming stack trace elements.
- */
-public class StackTraceElementConstants {
-
- public static final String ATTR_CLASS_LOADER_NAME = "classLoaderName";
- public static final String ATTR_MODULE = "module";
- public static final String ATTR_MODULE_VERSION = "moduleVersion";
- public static final String ATTR_CLASS = "class";
- public static final String ATTR_FILE = "file";
- public static final String ATTR_LINE = "line";
- public static final String ATTR_METHOD = "method";
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementMixIn.java
deleted file mode 100644
index 0d38b67502..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/StackTraceElementMixIn.java
+++ /dev/null
@@ -1,69 +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;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Jackson mix-in for {@link StackTraceElement}.
- * <p>
- * <em>Consider this class private.</em>
- * </p>
- *
- * @see StackTraceElement
- */
-@JsonIgnoreProperties("nativeMethod")
-public abstract class StackTraceElementMixIn {
-
- @JsonCreator
- protected StackTraceElementMixIn(
- // @formatter:off
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS_LOADER_NAME) final String classLoaderName,
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE) final String moduleName,
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE_VERSION) final String moduleVersion,
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS) final String declaringClass,
- @JsonProperty(StackTraceElementConstants.ATTR_METHOD) final String methodName,
- @JsonProperty(StackTraceElementConstants.ATTR_FILE) final String fileName,
- @JsonProperty(StackTraceElementConstants.ATTR_LINE) final int lineNumber)
- // @formatter:on
- {
- // empty
- }
-
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS_LOADER_NAME)
- protected abstract String getClassLoaderName();
-
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE)
- protected abstract String getModuleName();
-
- @JsonProperty(StackTraceElementConstants.ATTR_MODULE_VERSION)
- protected abstract String getModuleVersion();
-
- @JsonProperty(StackTraceElementConstants.ATTR_CLASS)
- protected abstract String getClassName();
-
- @JsonProperty(StackTraceElementConstants.ATTR_FILE)
- protected abstract String getFileName();
-
- @JsonProperty(StackTraceElementConstants.ATTR_LINE)
- protected abstract int getLineNumber();
-
- @JsonProperty(StackTraceElementConstants.ATTR_METHOD)
- protected abstract String getMethodName();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyMixIn.java
deleted file mode 100644
index 421fb06bb8..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyMixIn.java
+++ /dev/null
@@ -1,67 +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;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-
-/**
- * Mix-in for {@link ThrowableProxy}.
- */
-public abstract class ThrowableProxyMixIn {
-
- @JsonProperty(JsonConstants.ELT_CAUSE)
- private ThrowableProxyMixIn causeProxy;
-
- @JsonProperty
- private int commonElementCount;
-
- @JsonProperty(JsonConstants.ELT_EXTENDED_STACK_TRACE)
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JsonProperty
- private String localizedMessage;
-
- @JsonProperty
- private String message;
-
- @JsonProperty
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @JsonIgnore
- public abstract String getExtendedStackTraceAsString();
-
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @JsonProperty(JsonConstants.ELT_SUPPRESSED)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithStacktraceAsStringMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithStacktraceAsStringMixIn.java
deleted file mode 100644
index 32b6c0cd8f..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithStacktraceAsStringMixIn.java
+++ /dev/null
@@ -1,67 +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;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-
-/**
- * Mix-in for {@link org.apache.logging.log4j.core.impl.ThrowableProxy}.
- */
-public abstract class ThrowableProxyWithStacktraceAsStringMixIn {
-
- @JsonProperty(JsonConstants.ELT_CAUSE)
- private ThrowableProxyWithStacktraceAsStringMixIn causeProxy;
-
- @JsonProperty
- private int commonElementCount;
-
- @JsonIgnore
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JsonProperty
- private String localizedMessage;
-
- @JsonProperty
- private String message;
-
- @JsonProperty
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @JsonProperty(JsonConstants.ELT_EXTENDED_STACK_TRACE)
- public abstract String getExtendedStackTraceAsString();
-
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @JsonProperty(JsonConstants.ELT_SUPPRESSED)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithoutStacktraceMixIn.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithoutStacktraceMixIn.java
deleted file mode 100644
index 5a07df2617..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/ThrowableProxyWithoutStacktraceMixIn.java
+++ /dev/null
@@ -1,67 +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;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.logging.log4j.core.impl.ExtendedStackTraceElement;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-
-/**
- * Mix-in for {@link ThrowableProxy}.
- */
-public abstract class ThrowableProxyWithoutStacktraceMixIn {
-
- @JsonProperty(JsonConstants.ELT_CAUSE)
- private ThrowableProxyWithoutStacktraceMixIn causeProxy;
-
- @JsonProperty
- private int commonElementCount;
-
- @JsonIgnore
- private ExtendedStackTraceElement[] extendedStackTrace;
-
- @JsonProperty
- private String localizedMessage;
-
- @JsonProperty
- private String message;
-
- @JsonProperty
- private String name;
-
- @JsonIgnore
- private transient Throwable throwable;
-
- @JsonIgnore
- public abstract String getCauseStackTraceAsString();
-
- @JsonIgnore
- public abstract String getExtendedStackTraceAsString();
-
- @JsonIgnore
- public abstract StackTraceElement[] getStackTrace();
-
- @JsonProperty(JsonConstants.ELT_SUPPRESSED)
- public abstract ThrowableProxy[] getSuppressedProxies();
-
- @JsonIgnore
- public abstract String getSuppressedStackTrace();
-
- @JsonIgnore
- public abstract Throwable getThrowable();
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/XmlConstants.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/XmlConstants.java
deleted file mode 100644
index 0a4bf60616..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/XmlConstants.java
+++ /dev/null
@@ -1,40 +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;
-
-/**
- * Keeps constants separate from any class that may depend on third party jars.
- */
-public final class XmlConstants {
- public static final String ELT_CAUSE = "Cause";
- public static final String ELT_CONTEXT_MAP = "ContextMap";
- public static final String ELT_CONTEXT_STACK = "ContextStack";
- public static final String ELT_CONTEXT_STACK_ITEM = "ContextStackItem";
- public static final String ELT_EVENT = "Event";
- public static final String ELT_EXTENDED_STACK_TRACE = "ExtendedStackTrace";
- public static final String ELT_EXTENDED_STACK_TRACE_ITEM = "ExtendedStackTraceItem";
- public static final String ELT_TIME_MILLIS = "TimeMillis";
- public static final String ELT_INSTANT = "Instant";
- public static final String ELT_MARKER = "Marker";
- public static final String ELT_MESSAGE = "Message";
- public static final String ELT_PARENTS = "Parents";
- public static final String ELT_SOURCE = "Source";
- public static final String ELT_SUPPRESSED = "Suppressed";
- public static final String ELT_SUPPRESSED_ITEM = "SuppressedItem";
- public static final String ELT_THROWN = "Thrown";
- public static final String XML_NAMESPACE = "http://logging.apache.org/log4j/2.0/events";
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/layout/AbstractJacksonLayout.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/layout/AbstractJacksonLayout.java
deleted file mode 100644
index 244cb0920a..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/layout/AbstractJacksonLayout.java
+++ /dev/null
@@ -1,393 +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.layout;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.annotation.JsonUnwrapped;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.config.Configuration;
-import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-import org.apache.logging.log4j.core.layout.AbstractStringLayout;
-import org.apache.logging.log4j.core.lookup.StrSubstitutor;
-import org.apache.logging.log4j.core.util.KeyValuePair;
-import org.apache.logging.log4j.core.util.StringBuilderWriter;
-import org.apache.logging.log4j.jackson.XmlConstants;
-import org.apache.logging.log4j.plugins.PluginBuilderAttribute;
-import org.apache.logging.log4j.plugins.PluginElement;
-import org.apache.logging.log4j.util.Strings;
-
-abstract class AbstractJacksonLayout extends AbstractStringLayout {
-
- public abstract static class Builder<B extends Builder<B>> extends AbstractStringLayout.Builder<B> {
-
- @PluginBuilderAttribute
- private boolean eventEol;
-
- @PluginBuilderAttribute
- private String endOfLine;
-
- @PluginBuilderAttribute
- private boolean compact;
-
- @PluginBuilderAttribute
- private boolean complete;
-
- @PluginBuilderAttribute
- private boolean locationInfo;
-
- @PluginBuilderAttribute
- private boolean properties;
-
- @PluginBuilderAttribute
- private boolean includeStacktrace = true;
-
- @PluginBuilderAttribute
- private boolean stacktraceAsString = false;
-
- @PluginBuilderAttribute
- private boolean includeNullDelimiter = false;
-
- @PluginElement("AdditionalField")
- private KeyValuePair[] additionalFields;
-
- public KeyValuePair[] getAdditionalFields() {
- return additionalFields;
- }
-
- public boolean getEventEol() {
- return eventEol;
- }
-
- public String getEndOfLine() {
- return endOfLine;
- }
-
- public boolean isCompact() {
- return compact;
- }
-
- public boolean isComplete() {
- return complete;
- }
-
- public boolean isIncludeNullDelimiter() {
- return includeNullDelimiter;
- }
-
- /**
- * If "true", includes the stacktrace of any Throwable in the generated data, defaults to "true".
- *
- * @return If "true", includes the stacktrace of any Throwable in the generated data, defaults to "true".
- */
- public boolean isIncludeStacktrace() {
- return includeStacktrace;
- }
-
- public boolean isLocationInfo() {
- return locationInfo;
- }
-
- public boolean isProperties() {
- return properties;
- }
-
- public boolean isStacktraceAsString() {
- return stacktraceAsString;
- }
-
- /**
- * Additional fields to set on each log event.
- *
- * @return this builder
- */
- public B setAdditionalFields(final KeyValuePair[] additionalFields) {
- this.additionalFields = additionalFields;
- return asBuilder();
- }
-
- public B setCompact(final boolean compact) {
- this.compact = compact;
- return asBuilder();
- }
-
- public B setComplete(final boolean complete) {
- this.complete = complete;
- return asBuilder();
- }
-
- public B setEventEol(final boolean eventEol) {
- this.eventEol = eventEol;
- return asBuilder();
- }
-
- public B setEndOfLine(final String endOfLine) {
- this.endOfLine = endOfLine;
- return asBuilder();
- }
-
- /**
- * Whether to include NULL byte as delimiter after each event (optional, default to false).
- *
- * @return this builder
- */
- public B setIncludeNullDelimiter(final boolean includeNullDelimiter) {
- this.includeNullDelimiter = includeNullDelimiter;
- return asBuilder();
- }
-
- /**
- * If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".
- *
- * @param includeStacktrace
- * If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".
- * @return this builder
- */
- public B setIncludeStacktrace(final boolean includeStacktrace) {
- this.includeStacktrace = includeStacktrace;
- return asBuilder();
- }
-
- public B setLocationInfo(final boolean locationInfo) {
- this.locationInfo = locationInfo;
- return asBuilder();
- }
-
- public B setProperties(final boolean properties) {
- this.properties = properties;
- return asBuilder();
- }
-
- /**
- * Whether to format the stacktrace as a string, and not a nested object (optional, defaults to false).
- *
- * @return this builder
- */
- public B setStacktraceAsString(final boolean stacktraceAsString) {
- this.stacktraceAsString = stacktraceAsString;
- return asBuilder();
- }
-
- protected String toStringOrNull(final byte[] header) {
- return header == null ? null : new String(header, Charset.defaultCharset());
- }
- }
-
- @JsonRootName(XmlConstants.ELT_EVENT)
- public static class LogEventWrapperWithAdditionalFields {
-
- private final Object logEvent;
- private final Map<String, String> additionalFields;
-
- public LogEventWrapperWithAdditionalFields(final Object logEvent, final Map<String, String> additionalFields) {
- this.logEvent = logEvent;
- this.additionalFields = additionalFields;
- }
-
- @JsonAnyGetter
- @SuppressWarnings("unused")
- public Map<String, String> getAdditionalFields() {
- return additionalFields;
- }
-
- @JsonUnwrapped
- public Object getLogEvent() {
- return logEvent;
- }
- }
-
- protected static class ResolvableKeyValuePair {
-
- final String key;
- final String value;
- final boolean valueNeedsLookup;
-
- ResolvableKeyValuePair(final KeyValuePair pair) {
- this.key = pair.getKey();
- this.value = pair.getValue();
- this.valueNeedsLookup = AbstractJacksonLayout.valueNeedsLookup(this.value);
- }
- }
-
- protected static final String DEFAULT_EOL = "\r\n";
-
- protected static final String COMPACT_EOL = Strings.EMPTY;
-
- private static LogEvent convertMutableToLog4jEvent(final LogEvent event) {
- // TODO Jackson-based layouts have certain filters set up for Log4jLogEvent.
- // TODO Need to set up the same filters for MutableLogEvent but don't know how...
- // This is a workaround.
- return event instanceof Log4jLogEvent ? event : event.toMemento();
- }
-
- private static ResolvableKeyValuePair[] prepareAdditionalFields(
- final Configuration config, final KeyValuePair[] additionalFields) {
- if (additionalFields == null || additionalFields.length == 0) {
- // No fields set
- return new ResolvableKeyValuePair[0];
- }
-
- // Convert to specific class which already determines whether values needs lookup during serialization
- final ResolvableKeyValuePair[] resolvableFields = new ResolvableKeyValuePair[additionalFields.length];
-
- for (int i = 0; i < additionalFields.length; i++) {
- final ResolvableKeyValuePair resolvable =
- resolvableFields[i] = new ResolvableKeyValuePair(additionalFields[i]);
-
- // Validate
- if (config == null && resolvable.valueNeedsLookup) {
- throw new IllegalArgumentException(
- "configuration needs to be set when there are additional fields with variables");
- }
- }
-
- return resolvableFields;
- }
-
- protected static boolean valueNeedsLookup(final String value) {
- return value != null && value.contains("${");
- }
-
- protected final String eol;
- protected final ObjectWriter objectWriter;
-
- protected final boolean compact;
-
- protected final boolean complete;
-
- protected final boolean includeNullDelimiter;
-
- protected final ResolvableKeyValuePair[] additionalFields;
-
- protected AbstractJacksonLayout(
- final Configuration config,
- final ObjectWriter objectWriter,
- final Charset charset,
- final boolean compact,
- final boolean complete,
- final boolean eventEol,
- final Serializer headerSerializer,
- final Serializer footerSerializer,
- final boolean includeNullDelimiter,
- final KeyValuePair[] additionalFields) {
- this(
- config,
- objectWriter,
- charset,
- compact,
- complete,
- eventEol,
- null,
- headerSerializer,
- footerSerializer,
- includeNullDelimiter,
- additionalFields);
- }
-
- protected AbstractJacksonLayout(
- final Configuration config,
- final ObjectWriter objectWriter,
- final Charset charset,
- final boolean compact,
- final boolean complete,
- final boolean eventEol,
- final String endOfLine,
- final Serializer headerSerializer,
- final Serializer footerSerializer,
- final boolean includeNullDelimiter,
- final KeyValuePair[] additionalFields) {
- super(config, charset, headerSerializer, footerSerializer);
- this.objectWriter = objectWriter;
- this.compact = compact;
- this.complete = complete;
- this.eol = endOfLine != null ? endOfLine : compact && !eventEol ? COMPACT_EOL : DEFAULT_EOL;
- this.includeNullDelimiter = includeNullDelimiter;
- this.additionalFields = prepareAdditionalFields(config, additionalFields);
- }
-
- protected LogEventWrapperWithAdditionalFields createLogEventWrapperWithAdditionalFields(
- final LogEvent event, final Map<String, String> additionalFieldsMap) {
- return new LogEventWrapperWithAdditionalFields(event, additionalFieldsMap);
- }
-
- private Map<String, String> resolveAdditionalFields(final LogEvent logEvent) {
- // Note: LinkedHashMap retains order
- final Map<String, String> additionalFieldsMap = new LinkedHashMap<>(additionalFields.length);
- final StrSubstitutor strSubstitutor = configuration.getStrSubstitutor();
-
- // Go over each field
- for (final ResolvableKeyValuePair pair : additionalFields) {
- if (pair.valueNeedsLookup) {
- // Resolve value
- additionalFieldsMap.put(pair.key, strSubstitutor.replace(logEvent, pair.value));
- } else {
- // Plain text value
- additionalFieldsMap.put(pair.key, pair.value);
- }
- }
-
- return additionalFieldsMap;
- }
-
- /**
- * Formats a {@link org.apache.logging.log4j.core.LogEvent}.
- *
- * @param event The LogEvent.
- * @return The XML representation of the LogEvent.
- */
- @Override
- public String toSerializable(final LogEvent event) {
- final StringBuilderWriter writer = new StringBuilderWriter();
- try {
- toSerializable(event, writer);
- return writer.toString();
- } catch (final IOException e) {
- // Should this be an ISE or IAE?
- LOGGER.error(e);
- return Strings.EMPTY;
- }
- }
-
- public void toSerializable(final LogEvent event, final Writer writer)
- throws JsonGenerationException, JsonMappingException, IOException {
- objectWriter.writeValue(writer, wrapLogEvent(convertMutableToLog4jEvent(event)));
- writer.write(eol);
- if (includeNullDelimiter) {
- writer.write('\0');
- }
- markEvent();
- }
-
- protected Object wrapLogEvent(final LogEvent event) {
- if (additionalFields.length > 0) {
- // Construct map for serialization - note that we are intentionally using original LogEvent
- final Map<String, String> additionalFieldsMap = resolveAdditionalFields(event);
- // This class combines LogEvent with AdditionalFields during serialization
- return createLogEventWrapperWithAdditionalFields(event, additionalFieldsMap);
- }
- // No additional fields, return original object
- return event;
- }
-}
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/layout/package-info.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/layout/package-info.java
deleted file mode 100644
index a1e48f9e3e..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/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.layout;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/package-info.java b/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/package-info.java
deleted file mode 100644
index fc05ca9f7b..0000000000
--- a/log4j-layout-jackson/src/main/java/org/apache/logging/log4j/jackson/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-/**
- * Classes and interfaces for serializing and deserializing Log4j 2 log events to XML and JSON using the Jackson
- * library.
- */
-@Export
-@Version("1.0.0")
-package org.apache.logging.log4j.jackson;
-
-import org.osgi.annotation.bundle.Export;
-import org.osgi.annotation.versioning.Version;
diff --git a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/AbstractMarkerMixInTest.java b/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/AbstractMarkerMixInTest.java
deleted file mode 100644
index 4fb674d3ae..0000000000
--- a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/AbstractMarkerMixInTest.java
+++ /dev/null
@@ -1,98 +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;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import java.io.IOException;
-import org.apache.logging.log4j.Marker;
-import org.apache.logging.log4j.MarkerManager;
-import org.apache.logging.log4j.MarkerManager.Log4jMarker;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-/**
- * Tests {@link MarkerMixIn}.
- *
- * This class is in this package to let {@link Log4jMarker} have the least visibility.
- */
-public abstract class AbstractMarkerMixInTest {
-
- private ObjectReader reader;
- private ObjectWriter writer;
-
- protected abstract ObjectMapper newObjectMapper();
-
- @BeforeEach
- public void setUp() {
- final ObjectMapper log4jObjectMapper = newObjectMapper();
- writer = log4jObjectMapper.writer();
- reader = log4jObjectMapper.readerFor(Log4jMarker.class);
- MarkerManager.clear();
- }
-
- @Test
- public void testNameOnly() throws IOException {
- final Marker expected = MarkerManager.getMarker("A");
- final String str = writeValueAsString(expected);
- assertFalse(str.contains("parents"));
- final Marker actual = reader.readValue(str);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testOneParent() throws IOException {
- final Marker expected = MarkerManager.getMarker("A");
- final Marker parent = MarkerManager.getMarker("PARENT_MARKER");
- expected.addParents(parent);
- final String str = writeValueAsString(expected);
- assertTrue(str.contains("PARENT_MARKER"));
- final Marker actual = reader.readValue(str);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testTwoParents() throws IOException {
- final Marker expected = MarkerManager.getMarker("A");
- final Marker parent1 = MarkerManager.getMarker("PARENT_MARKER1");
- final Marker parent2 = MarkerManager.getMarker("PARENT_MARKER2");
- expected.addParents(parent1);
- expected.addParents(parent2);
- final String str = writeValueAsString(expected);
- assertTrue(str.contains("PARENT_MARKER1"));
- assertTrue(str.contains("PARENT_MARKER2"));
- final Marker actual = reader.readValue(str);
- assertEquals(expected, actual);
- }
-
- /**
- * @param expected
- * @return
- * @throws JsonProcessingException
- */
- private String writeValueAsString(final Marker expected) throws JsonProcessingException {
- final String str = writer.writeValueAsString(expected);
- // System.out.println(str);
- return str;
- }
-}
diff --git a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/LevelMixInTest.java b/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/LevelMixInTest.java
deleted file mode 100644
index caa7777f95..0000000000
--- a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/LevelMixInTest.java
+++ /dev/null
@@ -1,98 +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;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectReader;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import java.io.IOException;
-import java.util.Objects;
-import org.apache.logging.log4j.Level;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-/**
- * Tests {@link LevelMixIn}.
- */
-public abstract class LevelMixInTest {
-
- static class Fixture {
- @JsonProperty
- private final Level level = Level.DEBUG;
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final Fixture other = (Fixture) obj;
- if (!Objects.equals(this.level, other.level)) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- return 31 + Objects.hashCode(level);
- }
- }
-
- private ObjectMapper log4jObjectMapper;
-
- private ObjectReader reader;
-
- private ObjectWriter writer;
-
- protected abstract ObjectMapper newObjectMapper();
-
- @BeforeEach
- public void setUp() {
- log4jObjectMapper = newObjectMapper();
- writer = log4jObjectMapper.writer();
- reader = log4jObjectMapper.readerFor(Level.class);
- }
-
- @Test
- public void testContainer() throws IOException {
- final Fixture expected = new Fixture();
- final String str = writer.writeValueAsString(expected);
- assertTrue(str.contains("DEBUG"));
- final ObjectReader fixtureReader = log4jObjectMapper.readerFor(Fixture.class);
- final Fixture actual = fixtureReader.readValue(str);
- assertEquals(expected, actual);
- }
-
- @Test
- public void testNameOnly() throws IOException {
- final Level expected = Level.getLevel("DEBUG");
- final String str = writer.writeValueAsString(expected);
- assertTrue(str.contains("DEBUG"));
- final Level actual = reader.readValue(str);
- assertEquals(expected, actual);
- }
-}
diff --git a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/ThrowableProxyJacksonTest.java b/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/ThrowableProxyJacksonTest.java
deleted file mode 100644
index e17a2f4ca7..0000000000
--- a/log4j-layout-jackson/src/test/java/org/apache/logging/log4j/jackson/ThrowableProxyJacksonTest.java
+++ /dev/null
@@ -1,48 +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;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import org.apache.logging.log4j.core.impl.ThrowableProxy;
-
-/**
- *
- */
-public class ThrowableProxyJacksonTest {
-
- static class Fixture {
- @JsonProperty
- ThrowableProxy proxy = new ThrowableProxy(new IOException("test"));
- }
-
- protected void testIoContainer(final ObjectMapper objectMapper) throws IOException {
- final Fixture expected = new Fixture();
- final String s = objectMapper.writeValueAsString(expected);
- final Fixture actual = objectMapper.readValue(s, Fixture.class);
- assertEquals(expected.proxy.getName(), actual.proxy.getName());
- assertEquals(expected.proxy.getMessage(), actual.proxy.getMessage());
- assertEquals(expected.proxy.getLocalizedMessage(), actual.proxy.getLocalizedMessage());
- assertEquals(expected.proxy.getCommonElementCount(), actual.proxy.getCommonElementCount());
- assertArrayEquals(expected.proxy.getExtendedStackTrace(), actual.proxy.getExtendedStackTrace());
- assertEquals(expected.proxy, actual.proxy);
- }
-}
diff --git a/pom.xml b/pom.xml
index f1d578c2d3..c140c693d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,8 +256,6 @@
<module>log4j-jpl</module>
<module>log4j-jul</module>
<module>log4j-kubernetes</module>
- <module>log4j-layout-jackson</module>
- <module>log4j-layout-jackson-xml</module>
<module>log4j-layout-template-json</module>
<module>log4j-layout-template-json-test</module>
<module>log4j-mongodb4</module>
diff --git a/log4j-layout-jackson-xml/src/test/resources/log4j2-xml-layout.xml b/src/changelog/.3.x.x/remove_layout_jackson.xml
similarity index 70%
rename from log4j-layout-jackson-xml/src/test/resources/log4j2-xml-layout.xml
rename to src/changelog/.3.x.x/remove_layout_jackson.xml
index b75c3e49a1..9ba8577a71 100644
--- a/log4j-layout-jackson-xml/src/test/resources/log4j2-xml-layout.xml
+++ b/src/changelog/.3.x.x/remove_layout_jackson.xml
@@ -15,16 +15,9 @@
~ 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-xml-layout.log" append="false">
- <XmlLayout compact="true" eventEol="true" />
- </File>
- </Appenders>
-
- <Loggers>
- <Root level="INFO">
- <AppenderRef ref="stdout" />
- </Root>
- </Loggers>
-</Configuration>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://logging.apache.org/log4j/changelog"
+ xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.3.xsd"
+ type="removed">
+ <description format="asciidoc">Remove `log4j-layout-jackson` module</description>
+</entry>
diff --git a/log4j-core-test/src/test/resources/log4j2-xml-layout.xml b/src/changelog/.3.x.x/remove_layout_jackson_xml.xml
similarity index 70%
rename from log4j-core-test/src/test/resources/log4j2-xml-layout.xml
rename to src/changelog/.3.x.x/remove_layout_jackson_xml.xml
index 65b6a32579..11a2594424 100644
--- a/log4j-core-test/src/test/resources/log4j2-xml-layout.xml
+++ b/src/changelog/.3.x.x/remove_layout_jackson_xml.xml
@@ -15,16 +15,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<Configuration status="off">
- <Appenders>
- <File name="stdout" ignoreExceptions="false" fileName="target/test-xml-layout.log" append="false">
- <XmlLayout compact="true" eventEol="true"/>
- </File>
- </Appenders>
-
- <Loggers>
- <Root level="INFO">
- <AppenderRef ref="stdout"/>
- </Root>
- </Loggers>
-</Configuration>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://logging.apache.org/log4j/changelog"
+ xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.3.xsd"
+ type="removed">
+ <description format="asciidoc">Remove `log4j-layout-jackson-xml` module</description>
+</entry>
diff --git a/src/site/_release-notes/_3.x.x.adoc b/src/site/_release-notes/_3.x.x.adoc
index 0b495a76f1..7518f640fb 100644
--- a/src/site/_release-notes/_3.x.x.adoc
+++ b/src/site/_release-notes/_3.x.x.adoc
@@ -50,6 +50,8 @@ This release contains...
* Removed legacy `2.x` properties configuration factory.
* Remove `DefaultLogEventFactory`
* Remove `org.apache.logging.log4j.core.parser` and related packages. (https://github.com/apache/logging-log4j2/pull/2154[2154])
+* Remove `log4j-layout-jackson` module
+* Remove `log4j-layout-jackson-xml` module
* Remove `log4j2.enable.threadlocals` property (https://github.com/apache/logging-log4j2/issues/2105[2105])
[#release-notes-3-x-x-updated]
diff --git a/src/site/asciidoc/manual/layouts.adoc b/src/site/asciidoc/manual/layouts.adoc
index 0b7f74ab0e..80a3f6a3c1 100644
--- a/src/site/asciidoc/manual/layouts.adoc
+++ b/src/site/asciidoc/manual/layouts.adoc
@@ -1783,157 +1783,6 @@ syslog record. The default is false.
within the message text.
|===
-[#XMLLayout]
-== XML Layout
-
-Appends a series of `Event` elements as defined in the log4j.dtd.
-
-=== Complete well-formed XML vs. fragment XML
-
-If you configure `complete="true"`, the appender outputs a well-formed
-XML document where the default namespace is the Log4j namespace
-`"http://logging.apache.org/log4j/2.0/events"`. By default, with
-`complete="false"`, you should include the output as an _external
-entity_ in a separate file to form a well-formed XML document, in which
-case the appender uses `namespacePrefix` with a default of `"log4j"`.
-
-A well-formed XML document follows this pattern:
-
-[source,xml]
-----
-<Event xmlns="http://logging.apache.org/log4j/2.0/events"
- level="INFO"
- loggerName="HelloWorld"
- endOfBatch="false"
- thread="main"
- loggerFqcn="org.apache.logging.log4j.spi.AbstractLogger"
- threadId="1"
- threadPriority="5">
- <Instant epochSecond="1493121664" nanoOfSecond="118000000"/>
- <Marker name="child">
- <Parents>
- <Marker name="parent">
- <Parents>
- <Marker name="grandparent"/>
- </Parents>
- </Marker>
- </Parents>
- </Marker>
- <Message>Hello, world!</Message>
- <ContextMap>
- <item key="bar" value="BAR"/>
- <item key="foo" value="FOO"/>
- </ContextMap>
- <ContextStack>
- <ContextStackItem>one</ContextStackItem>
- <ContextStackItem>two</ContextStackItem>
- </ContextStack>
- <Source
- class="logtest.Main"
- method="main"
- file="Main.java"
- line="29"/>
- <Thrown commonElementCount="0" message="error message" name="java.lang.RuntimeException">
- <ExtendedStackTrace>
- <ExtendedStackTraceItem
- class="logtest.Main"
- method="main"
- file="Main.java"
- line="29"
- exact="true"
- location="classes/"
- version="?"/>
- </ExtendedStackTrace>
- </Thrown>
-</Event>
-----
-
-If `complete="false"`, the appender does not write the XML processing
-instruction and the root element.
-
-=== Marker
-
-Markers are represented by a `Marker` element within the `Event`
-element. The `Marker` element appears only when a marker is used in the
-log message. The name of the marker's parent will be provided in the
-`parent` attribute of the `Marker` element.
-
-=== Pretty vs. compact XML
-
-By default, the XML layout is not compact (a.k.a. not "pretty") with
-`compact="false"`, which means the appender uses end-of-line characters
-and indents lines to format the XML. If `compact="true"`, then no
-end-of-line or indentation is used. Message content may contain, of
-course, end-of-lines.
-
-.XmlLayout 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.
-
-|compact
-|boolean
-|If true, the appender does not use end-of-lines and
-indentation. Defaults to false.
-
-|complete
-|boolean
-|If true, the appender includes the XML header and
-footer. Defaults to false.
-
-|properties
-|boolean
-|If true, the appender includes the thread context
-map in the generated XML. Defaults to false.
-
-|locationInfo
-|boolean
-a|If true, the appender includes the location information in the generated
-XML. 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]
-----
-<XmlLayout>
- <KeyValuePair key="additionalField1" value="constant value"/>
- <KeyValuePair key="additionalField2" value="$${ctx:key}"/>
-</XmlLayout>
-----
-
-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 XmlLayout.
-
[#LocationInformation]
== Location Information
diff --git a/src/site/asciidoc/manual/migration.adoc b/src/site/asciidoc/manual/migration.adoc
index 3a9a4386ba..d561250bc5 100644
--- a/src/site/asciidoc/manual/migration.adoc
+++ b/src/site/asciidoc/manual/migration.adoc
@@ -95,12 +95,8 @@ using a lookup for the system property named `catalina.base`, in Log4j
1.x, the syntax would be `${catalina.base}`. In Log4j 2, the syntax
would be `${sys:catalina.base}`.
-Log4j 1.x has a XMLLayout which is different from the XmlLayout in Log4j
-2, the log4j-1.2-api module contains a `Log4j1XmlLayout` which produce
-output in the format as in Log4j 1.x. The Log4j 1.x `SimpleLayout` can
-be emulated with PatternLayout "%level - %m%n". The Log4j 1.x
-`TTCCLayout` can be emulated with PatternLayout "%r [%t] %p %c
-%notEmpty\{%ndc }- %m%n".
+The Log4j 1 `XmlLayout` can be emulated using the `Log4j1XmlLayout` provided by the `log4j-1.2-api` module of Log4j 2.
+The Log4j 1 `SimpleLayout` and `TTCCLayout` can be emulated using the Log4j 2 `PatternLayout` configured with `%level - %m%n` and `%r [%t] %p %c %notEmpty\{%ndc }- %m%n` patterns, respectively.
Both `PatternLayout` and `EnhancedPatternLayout` in Log4j 1.x can be
replaced with `PatternLayout` in Log4j 2. The log4j-1.2-api module
diff --git a/src/site/asciidoc/runtime-dependencies.adoc b/src/site/asciidoc/runtime-dependencies.adoc
index e98983a2a6..8ae1e384e0 100644
--- a/src/site/asciidoc/runtime-dependencies.adoc
+++ b/src/site/asciidoc/runtime-dependencies.adoc
@@ -479,9 +479,6 @@ the exact list of JAR files needed for these features.
|CSV Layout
|https://commons.apache.org/proper/commons-csv/[Apache Commons CSV]
-|XML Layout
-|https://github.com/FasterXML/jackson[Jackson core, databind and dataformat XML] and `com.fasterxml.woodstox:woodstox-core:5.0.2`
-
|Async Loggers
|http://lmax-exchange.github.io/disruptor/[LMAX Disruptor]
diff --git a/src/site/site.xml b/src/site/site.xml
index f1feb04f0a..032120a8c2 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -177,7 +177,6 @@
<item name="RFC-5424" href="/manual/layouts.html#RFC5424Layout"/>
<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="Location Information" href="/manual/layouts.html#LocationInformation"/>
</item>