Upgrade to Log4j2 2.8.2

Closes gh-8854
This commit is contained in:
Andy Wilkinson 2017-04-07 10:50:37 +01:00
parent cb34189c66
commit d43a75f0b7
5 changed files with 26 additions and 16 deletions

View File

@ -125,7 +125,7 @@
<junit.version>4.12</junit.version>
<lettuce.version>5.0.0.Beta1</lettuce.version>
<liquibase.version>3.5.3</liquibase.version>
<log4j2.version>2.7</log4j2.version>
<log4j2.version>2.8.2</log4j2.version>
<logback.version>1.2.3</logback.version>
<lombok.version>1.16.16</lombok.version>
<mariadb.version>1.5.9</mariadb.version>

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.springframework.boot.logging.log4j2;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.pattern.ConverterKeys;
import org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter;
@ -38,9 +39,11 @@ public final class ExtendedWhitespaceThrowablePatternConverter
private final ExtendedThrowablePatternConverter delegate;
private ExtendedWhitespaceThrowablePatternConverter(String[] options) {
super("WhitespaceExtendedThrowable", "throwable", options);
this.delegate = ExtendedThrowablePatternConverter.newInstance(options);
private ExtendedWhitespaceThrowablePatternConverter(Configuration configuration,
String[] options) {
super("WhitespaceExtendedThrowable", "throwable", options, configuration);
this.delegate = ExtendedThrowablePatternConverter.newInstance(configuration,
options);
}
@Override
@ -54,13 +57,14 @@ public final class ExtendedWhitespaceThrowablePatternConverter
/**
* Creates a new instance of the class. Required by Log4J2.
* @param configuration current configuration
* @param options pattern options, may be null. If first element is "short", only the
* first line of the throwable will be formatted.
* @return a new {@code WhitespaceThrowablePatternConverter}
*/
public static ExtendedWhitespaceThrowablePatternConverter newInstance(
String[] options) {
return new ExtendedWhitespaceThrowablePatternConverter(options);
Configuration configuration, String[] options) {
return new ExtendedWhitespaceThrowablePatternConverter(configuration, options);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.springframework.boot.logging.log4j2;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.pattern.ConverterKeys;
import org.apache.logging.log4j.core.pattern.PatternConverter;
@ -33,8 +34,9 @@ import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
@ConverterKeys({ "wEx", "wThrowable", "wException" })
public final class WhitespaceThrowablePatternConverter extends ThrowablePatternConverter {
private WhitespaceThrowablePatternConverter(String[] options) {
super("WhitespaceThrowable", "throwable", options);
private WhitespaceThrowablePatternConverter(Configuration configuration,
String[] options) {
super("WhitespaceThrowable", "throwable", options, configuration);
}
@Override
@ -48,12 +50,14 @@ public final class WhitespaceThrowablePatternConverter extends ThrowablePatternC
/**
* Creates a new instance of the class. Required by Log4J2.
* @param configuration current configuration
* @param options pattern options, may be null. If first element is "short", only the
* first line of the throwable will be formatted.
* @return a new {@code WhitespaceThrowablePatternConverter}
*/
public static WhitespaceThrowablePatternConverter newInstance(String[] options) {
return new WhitespaceThrowablePatternConverter(options);
public static WhitespaceThrowablePatternConverter newInstance(
Configuration configuration, String[] options) {
return new WhitespaceThrowablePatternConverter(configuration, options);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.springframework.boot.logging.log4j2;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
import org.junit.Test;
@ -34,7 +35,7 @@ public class ExtendedWhitespaceThrowablePatternConverterTests {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private final ThrowablePatternConverter converter = ExtendedWhitespaceThrowablePatternConverter
.newInstance(new String[] {});
.newInstance(new DefaultConfiguration(), new String[] {});
@Test
public void noStackTrace() throws Exception {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.springframework.boot.logging.log4j2;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.pattern.ThrowablePatternConverter;
import org.junit.Test;
@ -33,7 +34,7 @@ public class WhitespaceThrowablePatternConverterTests {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private final ThrowablePatternConverter converter = WhitespaceThrowablePatternConverter
.newInstance(new String[] {});
.newInstance(new DefaultConfiguration(), new String[] {});
@Test
public void noStackTrace() throws Exception {