This commit is contained in:
Phillip Webb
2016-01-21 11:46:46 -08:00
parent acfae2ebff
commit cf93f84e87
12 changed files with 56 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 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.
@@ -111,8 +111,8 @@ public class JavaLoggingSystem extends AbstractLoggingSystem {
@Override
public void setLogLevel(String loggerName, LogLevel level) {
Assert.notNull(level, "Level must not be null");
Logger logger = Logger
.getLogger(StringUtils.hasText(loggerName) ? loggerName : "");
String name = (StringUtils.hasText(loggerName) ? loggerName : "");
Logger logger = Logger.getLogger(name);
logger.setLevel(LEVELS.get(level));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 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.
@@ -208,10 +208,9 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
return getLoggerContext().getConfiguration().getLoggerConfig("");
}
private LoggerConfig getLoggerConfig(String loggerName) {
loggerName = StringUtils.hasText(loggerName) ? loggerName
: LogManager.ROOT_LOGGER_NAME;
return getLoggerContext().getConfiguration().getLoggers().get(loggerName);
private LoggerConfig getLoggerConfig(String name) {
name = (StringUtils.hasText(name) ? name : LogManager.ROOT_LOGGER_NAME);
return getLoggerContext().getConfiguration().getLoggers().get(name);
}
private LoggerContext getLoggerContext() {

View File

@@ -49,7 +49,7 @@ import static org.junit.Assert.assertThat;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(TestConfig.class)
@IntegrationTest({"foo=one", "bar=two"})
@IntegrationTest({ "foo=one", "bar=two" })
public class ConverterBindingTests {
@Value("${foo:}")
@@ -88,11 +88,13 @@ public class ConverterBindingTests {
return new GenericConverter() {
@Override
public Set<ConvertiblePair> getConvertibleTypes() {
return Collections.singleton(new ConvertiblePair(String.class, Bar.class));
return Collections
.singleton(new ConvertiblePair(String.class, Bar.class));
}
@Override
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
public Object convert(Object source, TypeDescriptor sourceType,
TypeDescriptor targetType) {
return new Bar((String) source);
}
};
@@ -112,6 +114,7 @@ public class ConverterBindingTests {
public Foo(String name) {
this.name = name;
}
}
public static class Bar {
@@ -121,6 +124,7 @@ public class ConverterBindingTests {
public Bar(String name) {
this.name = name;
}
}
@ConfigurationProperties
@@ -145,6 +149,7 @@ public class ConverterBindingTests {
public void setBar(Bar bar) {
this.bar = bar;
}
}
}