INT-4407: Add merge option to Log4j2LevelAdjuster

JIRA: https://jira.spring.io/browse/INT-4407

To make a `Log4j2LevelAdjuster` more builder friendly, add a `merge`
option to the overloaded `classes()` and `categories()` methods.
This way the existing (or previously configured) `categories` and
`classes` are merged with the provided values and default
`org.springframework.integration` category can be reuse.

Note: this behavior can be reconsidered as default one in the `5.1`
This commit is contained in:
Artem Bilan
2018-02-20 14:58:52 -05:00
committed by Gary Russell
parent 4bb4a0187a
commit e46fc9b738
6 changed files with 40 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* Copyright 2016-2018 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.
@@ -57,6 +57,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Gary Russell
* @author Artem Bilan
*
* @since 4.3
*
*/
@@ -74,8 +75,9 @@ public class FtpStreamingMessageSourceTests extends FtpTestSupport {
private SourcePollingChannelAdapter adapter;
@Rule
public Log4j2LevelAdjuster adjuster = Log4j2LevelAdjuster.debug()
.categories("org.springframework.integration", "org.apache.commons");
public Log4j2LevelAdjuster adjuster =
Log4j2LevelAdjuster.debug()
.categories(true, "org.apache.commons");
@SuppressWarnings("unchecked")
@Test