Skip to content

Commit

Permalink
[LOG4J2-2237] Move Jackson-based layouts to their own modules: JSON,
Browse files Browse the repository at this point in the history
XML, and YAML.
  • Loading branch information
garydgregory committed Feb 20, 2018
1 parent ec3c623 commit 0eb5212
Show file tree
Hide file tree
Showing 139 changed files with 5,507 additions and 1,536 deletions.
24 changes: 24 additions & 0 deletions log4j-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@
<artifactId>log4j-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Commons code for Jackson-based layouts -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Jackson-based JSON layout -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-json</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Jackson-based XML layout -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-xml</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Jackson-based YAML layout -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-yaml</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Legacy Log4j 1.2 API -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
24 changes: 22 additions & 2 deletions log4j-core-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
<description>Integration Tests for the Apache Log4j Implementation</description>
<properties>
<log4jParentDir>${basedir}/..</log4jParentDir>
<docLabel>Core Documentation</docLabel>
<projectDir>/core</projectDir>
<docLabel>Core Integration Tests Documentation</docLabel>
<projectDir>/log4j-core-its</projectDir>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand All @@ -46,13 +47,32 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-json</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-jackson-xml</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- Used for testing HttpAppender -->
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<scope>test</scope>
</dependency>
<!-- Required for AsyncLoggers -->
<dependency>
<groupId>com.lmax</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.config.Property;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.layout.JsonLayout;
import org.apache.logging.log4j.core.lookup.JavaLookup;
import org.apache.logging.log4j.core.net.ssl.KeyStoreConfiguration;
import org.apache.logging.log4j.core.net.ssl.SslConfiguration;
import org.apache.logging.log4j.core.net.ssl.TestConstants;
import org.apache.logging.log4j.core.net.ssl.TrustStoreConfiguration;
import org.apache.logging.log4j.jackson.json.layout.JsonLayout;
import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.message.SimpleMessage;
import org.apache.logging.log4j.status.StatusData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
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;
Expand All @@ -39,8 +41,6 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import static org.junit.Assert.*;

/**
* Tests a "complete" JSON file.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LoggingException;
import org.apache.logging.log4j.ThreadContext;
Expand All @@ -45,11 +43,11 @@
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.jackson.Log4jJsonObjectMapper;
import org.apache.logging.log4j.core.layout.JsonLayout;
import org.apache.logging.log4j.core.net.Protocol;
import org.apache.logging.log4j.core.util.Constants;
import org.apache.logging.log4j.core.util.Throwables;
import org.apache.logging.log4j.jackson.json.Log4jJsonObjectMapper;
import org.apache.logging.log4j.jackson.json.layout.JsonLayout;
import org.apache.logging.log4j.test.AvailablePortFinder;
import org.junit.After;
import org.junit.AfterClass;
Expand All @@ -58,6 +56,9 @@
import org.junit.Ignore;
import org.junit.Test;

import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
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;
Expand All @@ -29,8 +32,6 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;

import static org.junit.Assert.*;

/**
* Tests a "compact" XML file, no extra spaces or end of lines.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
*/
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.nio.file.Paths;
import java.util.List;

import org.apache.logging.log4j.Logger;
Expand All @@ -39,8 +42,6 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import static org.junit.Assert.*;

/**
* Tests a "complete" XML file a.k.a. a well-formed XML file.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.apache.logging.log4j.core.appender;

import java.io.BufferedReader;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.FileReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.List;
Expand All @@ -32,8 +32,6 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;

import static org.junit.Assert.*;

/**
* Tests a "complete" XML file a.k.a. a well-formed XML file.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
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;
Expand All @@ -30,8 +33,6 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;

import static org.junit.Assert.*;

/**
* Tests a "complete" XML file a.k.a. a well-formed XML file.
*/
Expand Down
6 changes: 0 additions & 6 deletions log4j-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,6 @@
<artifactId>groovy-all</artifactId>
<scope>test</scope>
</dependency>
<!-- Used for testing HttpAppender -->
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<scope>test</scope>
</dependency>
<!-- GC-free -->
<dependency>
<groupId>com.google.code.java-allocation-instrumenter</groupId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public Map<String, String> getContentFormat() {

@Override
public String getContentType() {
return JsonLayout.CONTENT_TYPE + "; charset=" + this.getCharset();
return "application/json; charset=" + this.getCharset();
}

@Override
Expand Down
Loading

0 comments on commit 0eb5212

Please sign in to comment.