diff options
| author | Alex Rudyy <orudyy@apache.org> | 2014-12-10 17:34:24 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2014-12-10 17:34:24 +0000 |
| commit | fd6bd8b5dee6807e7890f4eda578a73b4b1bb4dc (patch) | |
| tree | f003208d7e86053d4859195b0d58a33a792e3e24 /qpid/java | |
| parent | 71ddec5d6e828d3078a3782ab81955a538d22762 (diff) | |
| download | qpid-python-fd6bd8b5dee6807e7890f4eda578a73b4b1bb4dc.tar.gz | |
QPID-6265: Change system tests to have one log per file configured using Log4j, simplify QBTC
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1644492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
26 files changed, 530 insertions, 471 deletions
diff --git a/qpid/java/bdbstore/systests/pom.xml b/qpid/java/bdbstore/systests/pom.xml index b56488bc03..a5e9e2c609 100644 --- a/qpid/java/bdbstore/systests/pom.xml +++ b/qpid/java/bdbstore/systests/pom.xml @@ -80,6 +80,16 @@ </dependencies> <build> + + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>${test.resource.directory}/test-profiles/test_resources</directory> + </resource> + </resources> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java index fab889a49f..874b5eb324 100644 --- a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java +++ b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBBackupTest.java @@ -31,6 +31,7 @@ import javax.jms.MessageConsumer; import javax.jms.Session; import org.apache.log4j.Logger; +import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBVirtualHostNode; import org.apache.qpid.test.utils.Piper; @@ -151,15 +152,15 @@ public class BDBBackupTest extends QpidBrokerTestCase Process backupProcess = null; try { - String qpidHome = System.getProperty(QPID_HOME); + String qpidHome = QPID_HOME; ProcessBuilder pb = new ProcessBuilder(qpidHome + BACKUP_SCRIPT, "-todir", backupToDir.getAbsolutePath(), "-fromdir", backupFromDir.getAbsolutePath()); pb.redirectErrorStream(true); Map<String, String> env = pb.environment(); - env.put(QPID_HOME, qpidHome); + env.put(BrokerProperties.PROPERTY_QPID_HOME, qpidHome); LOGGER.debug("Backup command is " + pb.command()); backupProcess = pb.start(); - Piper piper = new Piper(backupProcess.getInputStream(), _testcaseOutputStream, null, BACKUP_COMPLETE_MESSAGE); + Piper piper = new Piper(backupProcess.getInputStream(), null, BACKUP_COMPLETE_MESSAGE, "BACKUP", ""); piper.start(); piper.await(2, TimeUnit.SECONDS); backupProcess.waitFor(); diff --git a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java index a209b476cf..9455d788e4 100644 --- a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java +++ b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java @@ -209,7 +209,7 @@ public class GroupCreator { try { - _testcase.startBroker(brokerPortNumber, brokerConfig); + _testcase.startBroker(brokerPortNumber, brokerConfig, null); return "OK"; } catch (Exception e) diff --git a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java index 4fd3540964..8933297b4a 100644 --- a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java +++ b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java @@ -45,6 +45,7 @@ import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore; import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode; import org.apache.qpid.systest.rest.RestTestHelper; +import org.apache.qpid.test.utils.BrokerHolder; import org.apache.qpid.test.utils.JMXTestUtils; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.junit.Assert; @@ -72,7 +73,7 @@ public class JMXManagementTest extends QpidBrokerTestCase @Override protected void setUp() throws Exception { - _brokerType = BrokerType.SPAWNED; + _brokerType = BrokerHolder.BrokerType.SPAWNED; setTestClientSystemProperty("log4j.configuration", getBrokerCommandLog4JFile().toURI().toString()); diff --git a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java index 50ca39c83b..7ec28bd1f2 100644 --- a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java +++ b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/MultiNodeTest.java @@ -48,6 +48,7 @@ import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.State; import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode; +import org.apache.qpid.test.utils.BrokerHolder; import org.apache.qpid.test.utils.QpidBrokerTestCase; import org.apache.qpid.test.utils.TestUtils; @@ -75,7 +76,7 @@ public class MultiNodeTest extends QpidBrokerTestCase @Override protected void setUp() throws Exception { - _brokerType = BrokerType.SPAWNED; + _brokerType = BrokerHolder.BrokerType.SPAWNED; assertTrue(isJavaBroker()); assertTrue(isBrokerStorePersistent()); diff --git a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java index 49ce60d798..b06eaf9f7c 100644 --- a/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java +++ b/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java @@ -28,6 +28,7 @@ import javax.jms.JMSException; import org.apache.qpid.jms.ConnectionURL; import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode; +import org.apache.qpid.test.utils.BrokerHolder; import org.apache.qpid.test.utils.QpidBrokerTestCase; public class TwoNodeTest extends QpidBrokerTestCase @@ -47,7 +48,7 @@ public class TwoNodeTest extends QpidBrokerTestCase @Override protected void setUp() throws Exception { - _brokerType = BrokerType.SPAWNED; + _brokerType = BrokerHolder.BrokerType.SPAWNED; setTestClientSystemProperty("log4j.configuration", getBrokerCommandLog4JFile().toURI().toString()); diff --git a/qpid/java/pom.xml b/qpid/java/pom.xml index d2d132294d..43e50980d1 100644 --- a/qpid/java/pom.xml +++ b/qpid/java/pom.xml @@ -218,9 +218,6 @@ <amqj.server.logging.level>debug</amqj.server.logging.level> <amqj.protocol.logging.level>debug</amqj.protocol.logging.level> <root.logging.level>warn</root.logging.level> - <log4j.configuration.file>${project.basedir}${file.separator}test-profiles${file.separator}log4j-test.xml</log4j.configuration.file> - <log4j.configuration>log4j-test.xml</log4j.configuration> - <log4j.debug>false</log4j.debug> <test.port>15672</test.port> <test.mport>18999</test.mport> <test.cport>19099</test.cport> diff --git a/qpid/java/qpid-perftests-systests/pom.xml b/qpid/java/qpid-perftests-systests/pom.xml index 64a5708501..e3c52326e3 100644 --- a/qpid/java/qpid-perftests-systests/pom.xml +++ b/qpid/java/qpid-perftests-systests/pom.xml @@ -110,6 +110,14 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>${test.resource.directory}/test-profiles/test_resources</directory> + </resource> + </resources> <testResources> <testResource> <directory>src/test/java</directory> diff --git a/qpid/java/qpid-systests-parent/pom.xml b/qpid/java/qpid-systests-parent/pom.xml index 88c0c45354..ce25221ffc 100644 --- a/qpid/java/qpid-systests-parent/pom.xml +++ b/qpid/java/qpid-systests-parent/pom.xml @@ -35,7 +35,8 @@ <!-- test properties --> <qpid.home>${basedir}${file.separator}${broker.home.dir}</qpid.home> <qpid.home.qbtc.output>${qpid.home}${file.separator}qbtc-output</qpid.home.qbtc.output> - <test.log4j.configuration.file>${project.basedir}${file.separator}..${file.separator}test-profiles${file.separator}log4j-test.xml</test.log4j.configuration.file> + <test.output.dir>${basedir}${file.separator}target${file.separator}surefire-reports</test.output.dir> + <test.working.directory>${basedir}/..</test.working.directory> <test.resource.directory>${basedir}/..</test.resource.directory> <test.systest.resource.directory>${basedir}</test.systest.resource.directory> @@ -83,7 +84,14 @@ integration-test phase below instead --> <skip>true</skip> <systemPropertyVariables> - <log4j.configuration.file>${test.log4j.configuration.file}</log4j.configuration.file> + <test.output.dir>${test.output.dir}</test.output.dir> + <log4j.configuration.file>${basedir}${file.separator}target${file.separator}classes/log4j.xml</log4j.configuration.file> + <!-- Let the tests themselves configure logging so that we can have a separate log file per test + named after the test. --> + <log4j.debug>false</log4j.debug> + <log4j.defaultInitOverride>true</log4j.defaultInitOverride> + <!-- A log4j config file that sends all the Broker's output to stdout --> + <spawnedbroker.log4j.configuration.file>${basedir}${file.separator}target${file.separator}classes/spawned-broker-log4j.xml</spawnedbroker.log4j.configuration.file> </systemPropertyVariables> </configuration> <executions> diff --git a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java index 5c9dc12d77..9238224f50 100644 --- a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java +++ b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java @@ -46,7 +46,7 @@ public class QpidTestCase extends TestCase public static final String TEST_RESOURCES_DIR = QPID_HOME + "/../test-profiles/test_resources/"; public static final String TEST_PROFILES_DIR = QPID_HOME + "/../test-profiles/"; public static final String TMP_FOLDER = System.getProperty("java.io.tmpdir"); - public static final String LOG4J_CONFIG_FILE_PATH = System.getProperty("log4j.configuration.file"); + public static final String SPAWNED_BROKER_LOG4J_CONFIG_FILE_PATH = System.getProperty("spawnedbroker.log4j.configuration.file"); private static final Logger _logger = Logger.getLogger(QpidTestCase.class); diff --git a/qpid/java/systests/pom.xml b/qpid/java/systests/pom.xml index d6c095dd4c..26e1d5b974 100644 --- a/qpid/java/systests/pom.xml +++ b/qpid/java/systests/pom.xml @@ -189,4 +189,15 @@ </dependencies> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + </resource> + <resource> + <directory>${test.resource.directory}/test-profiles/test_resources</directory> + </resource> + </resources> + </build> + </project> diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java index 3af57327d2..4537d1a678 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/BrokerHolder.java @@ -20,10 +20,19 @@ */ package org.apache.qpid.test.utils; +import org.apache.qpid.server.BrokerOptions; + public interface BrokerHolder { - String getWorkingDirectory(); + public void start(BrokerOptions options) throws Exception; void shutdown(); void kill(); String dumpThreads(); + + enum BrokerType + { + EXTERNAL /** Test case relies on a Broker started independently of the test-suite */, + INTERNAL /** Test case starts an embedded broker within this JVM */, + SPAWNED /** Test case spawns a new broker as a separate process */ + } } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java index f980453d49..a76f79f8b0 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/InternalBrokerHolder.java @@ -21,12 +21,13 @@ package org.apache.qpid.test.utils; import java.security.PrivilegedAction; +import java.util.Map; import java.util.Set; import org.apache.log4j.Logger; import org.apache.qpid.server.Broker; -import org.apache.qpid.server.security.auth.TaskPrincipal; +import org.apache.qpid.server.BrokerOptions; import org.apache.qpid.server.security.SecurityManager; import javax.security.auth.Subject; @@ -35,27 +36,22 @@ public class InternalBrokerHolder implements BrokerHolder { private static final Logger LOGGER = Logger.getLogger(InternalBrokerHolder.class); - private final Broker _broker; - private final String _workingDirectory; + private Broker _broker; private Set<Integer> _portsUsedByBroker; - public InternalBrokerHolder(final Broker broker, String workingDirectory, Set<Integer> portsUsedByBroker) + public InternalBrokerHolder(Set<Integer> portsUsedByBroker) { - if(broker == null) - { - throw new IllegalArgumentException("Broker must not be null"); - } - - _broker = broker; - _workingDirectory = workingDirectory; _portsUsedByBroker = portsUsedByBroker; } @Override - public String getWorkingDirectory() + public void start(BrokerOptions options) throws Exception { - return _workingDirectory; + LOGGER.info("Starting internal broker (same JVM)"); + + _broker = new Broker(); + _broker.startup(options); } public void shutdown() diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/Piper.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/Piper.java index 9413e38606..12be233c35 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/Piper.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/Piper.java @@ -35,27 +35,21 @@ public final class Piper extends Thread private static final Logger LOGGER = Logger.getLogger(Piper.class); private final BufferedReader _in; - private final PrintStream _out; + private final Logger _out; private final String _ready; private final CountDownLatch _latch; private final String _stopped; - private final String _prefix; private volatile boolean _seenReady; private volatile String _stopLine; - public Piper(InputStream in, PrintStream out, String ready, String stopped) - { - this(in, out, ready, stopped, null); - } - - public Piper(InputStream in, PrintStream out, String ready, String stopped, String prefix) + public Piper(InputStream in, String ready, String stopped, String threadName, String loggerName) { + super(threadName); _in = new BufferedReader(new InputStreamReader(in)); - _out = out; + _out = Logger.getLogger(loggerName); _ready = ready; _stopped = stopped; _seenReady = false; - _prefix = prefix; if (this._ready != null && !this._ready.equals("")) { @@ -87,11 +81,7 @@ public final class Piper extends Thread String line; while ((line = _in.readLine()) != null) { - if (_prefix != null) - { - line = _prefix + line; - } - _out.println(line); + _out.info(line); if (_latch != null && line.contains(_ready)) { diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java index 369a76a6c6..9a3308603b 100755 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java @@ -18,9 +18,7 @@ package org.apache.qpid.test.utils; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -28,7 +26,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.concurrent.TimeUnit; import javax.jms.BytesMessage; import javax.jms.Connection; @@ -48,8 +45,10 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.apache.commons.lang.StringUtils; +import org.apache.log4j.FileAppender; +import org.apache.log4j.LogManager; import org.apache.log4j.Logger; +import org.apache.log4j.xml.DOMConfigurator; import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnectionFactory; @@ -60,7 +59,6 @@ import org.apache.qpid.exchange.ExchangeDefaults; import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.jms.BrokerDetails; import org.apache.qpid.jms.ConnectionURL; -import org.apache.qpid.server.Broker; import org.apache.qpid.server.BrokerOptions; import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.configuration.updater.TaskExecutor; @@ -83,19 +81,11 @@ public class QpidBrokerTestCase extends QpidTestCase { private TaskExecutor _taskExecutor; - public enum BrokerType - { - EXTERNAL /** Test case relies on a Broker started independently of the test-suite */, - INTERNAL /** Test case starts an embedded broker within this JVM */, - SPAWNED /** Test case spawns a new broker as a separate process */ - } - public static final String GUEST_USERNAME = "guest"; public static final String GUEST_PASSWORD = "guest"; - protected final static String QpidHome = System.getProperty("QPID_HOME"); private final File _configFile = new File(System.getProperty("broker.config")); - private File _logConfigFile; + private File _spawnedBrokerLogConfigFile; protected final String _brokerStoreType = System.getProperty("broker.config-store-type", "JSON"); protected static final Logger _logger = Logger.getLogger(QpidBrokerTestCase.class); protected static final int LOGMONITOR_TIMEOUT = 5000; @@ -128,11 +118,7 @@ public class QpidBrokerTestCase extends QpidTestCase private static final String BROKER_COMMAND_PLATFORM = "broker.command." + SystemUtils.getOSConfigSuffix(); private static final String BROKER_CLEAN_BETWEEN_TESTS = "broker.clean.between.tests"; private static final String BROKER_VERSION = "broker.version"; - protected static final String BROKER_READY = "broker.ready"; - private static final String BROKER_STOPPED = "broker.stopped"; private static final String TEST_OUTPUT = "test.output"; - private static final String BROKER_LOG_INTERLEAVE = "broker.log.interleave"; - private static final String BROKER_LOG_PREFIX = "broker.log.prefix"; private static final String BROKER_PERSITENT = "broker.persistent"; public static final String PROFILE_USE_SSL = "profile.use_ssl"; @@ -141,41 +127,30 @@ public class QpidBrokerTestCase extends QpidTestCase public static final int DEFAULT_JMXPORT_REGISTRYSERVER = 8999; public static final int JMXPORT_CONNECTORSERVER_OFFSET = 100; public static final int DEFAULT_HTTP_MANAGEMENT_PORT_VALUE = 8080; - public static final int DEFAULT_HTTPS_MANAGEMENT_PORT_VALUE = 8443; public static final String TEST_AMQP_PORT_PROTOCOLS_PROPERTY="test.amqp_port_protocols"; // values protected static final String JAVA = "java"; - protected static final String CPP = "cpp"; - - protected static final String QPID_HOME = "QPID_HOME"; public static final int DEFAULT_PORT = Integer.getInteger("test.port", DEFAULT_PORT_VALUE); public static final int FAILING_PORT = Integer.parseInt(System.getProperty("test.port.alt")); public static final int DEFAULT_MANAGEMENT_PORT = Integer.getInteger("test.mport", DEFAULT_JMXPORT_REGISTRYSERVER); public static final int DEFAULT_HTTP_MANAGEMENT_PORT = Integer.getInteger("test.hport", DEFAULT_HTTP_MANAGEMENT_PORT_VALUE); - public static final int DEFAULT_HTTPS_MANAGEMENT_PORT = Integer.getInteger("test.hsport", DEFAULT_HTTPS_MANAGEMENT_PORT_VALUE); public static final int DEFAULT_SSL_PORT = Integer.getInteger("test.port.ssl", DEFAULT_SSL_PORT_VALUE); protected String _brokerLanguage = System.getProperty(BROKER_LANGUAGE, JAVA); - protected BrokerType _brokerType = BrokerType.valueOf(System.getProperty(BROKER_TYPE, "").toUpperCase()); + protected BrokerHolder.BrokerType _brokerType = BrokerHolder.BrokerType.valueOf(System.getProperty(BROKER_TYPE, "").toUpperCase()); private static final String BROKER_COMMAND_TEMPLATE = System.getProperty(BROKER_COMMAND_PLATFORM, System.getProperty(BROKER_COMMAND)); - protected BrokerCommandHelper _brokerCommandHelper = new BrokerCommandHelper(BROKER_COMMAND_TEMPLATE); private Boolean _brokerCleanBetweenTests = Boolean.getBoolean(BROKER_CLEAN_BETWEEN_TESTS); private final Protocol _brokerProtocol = Protocol.valueOf("AMQP_" + System.getProperty(BROKER_VERSION, " ").substring(1)); protected String _output = System.getProperty(TEST_OUTPUT, System.getProperty("java.io.tmpdir")); protected Boolean _brokerPersistent = Boolean.getBoolean(BROKER_PERSITENT); - protected static String _brokerLogPrefix = System.getProperty(BROKER_LOG_PREFIX,"BROKER: "); - protected static boolean _interleaveBrokerLog = Boolean.valueOf(System.getProperty(BROKER_LOG_INTERLEAVE,"true")); - protected File _outputFile; - protected PrintStream _testcaseOutputStream; - protected Map<Integer, BrokerHolder> _brokers = new HashMap<Integer, BrokerHolder>(); protected InitialContext _initialContext; @@ -195,6 +170,8 @@ public class QpidBrokerTestCase extends QpidTestCase /** Size to create our message*/ private int _messageSize = DEFAULT_MESSAGE_SIZE; + private String _brokerCommandTemplate; + /** Type of message*/ protected enum MessageType { @@ -210,7 +187,8 @@ public class QpidBrokerTestCase extends QpidTestCase { super(); _brokerConfigurations = new HashMap<Integer, TestBrokerConfiguration>(); - initialiseLogConfigFile(); + initialiseSpawnedBrokerLogConfigFile(); + _brokerCommandTemplate = BROKER_COMMAND_TEMPLATE; } public TestBrokerConfiguration getBrokerConfiguration(int port) @@ -259,12 +237,12 @@ public class QpidBrokerTestCase extends QpidTestCase return configuration; } - private void initialiseLogConfigFile() + private void initialiseSpawnedBrokerLogConfigFile() { - _logConfigFile = new File(LOG4J_CONFIG_FILE_PATH); - if(!_logConfigFile.exists()) + _spawnedBrokerLogConfigFile = new File(SPAWNED_BROKER_LOG4J_CONFIG_FILE_PATH); + if(!_spawnedBrokerLogConfigFile.exists()) { - throw new RuntimeException("Log config file " + _logConfigFile.getAbsolutePath() + " does not exist"); + throw new RuntimeException("Log config file " + _spawnedBrokerLogConfigFile.getAbsolutePath() + " does not exist"); } } @@ -276,36 +254,18 @@ public class QpidBrokerTestCase extends QpidTestCase @Override public void runBare() throws Throwable { - String qname = getClass().getName() + "." + getName(); - // Initialize this for each test run _env = new HashMap<String, String>(); - PrintStream oldOut = System.out; - PrintStream oldErr = System.err; - PrintStream out = null; - PrintStream err = null; + // Log4j properties expects this to be set + System.setProperty("qpid.testMethod", "-" + getName()); + System.setProperty("qpid.testClass", getClass().getName()); - boolean redirected = _output != null && _output.length() > 0; - if (redirected) - { - _outputFile = new File(String.format("%s/TEST-%s.out", _output, qname)); - out = new PrintStream(new FileOutputStream(_outputFile), true); - err = new PrintStream(String.format("%s/TEST-%s.err", _output, qname)); + String log4jConfigFile = System.getProperty("log4j.configuration.file"); + DOMConfigurator.configure(log4jConfigFile); - System.setOut(out); - System.setErr(err); - - if (_interleaveBrokerLog) - { - _testcaseOutputStream = out; - } - else - { - _testcaseOutputStream = new PrintStream(new FileOutputStream(String - .format("%s/TEST-%s.broker.out", _output, qname)), true); - } - } + // get log file from file appender + _outputFile = new File(((FileAppender)LogManager.getRootLogger().getAllAppenders().nextElement()).getFile()); try { @@ -324,7 +284,7 @@ public class QpidBrokerTestCase extends QpidTestCase revertSystemProperties(); revertLoggingLevels(); - if(_brokerCleanBetweenTests) + if (_brokerCleanBetweenTests) { final String qpidWork = System.getProperty("QPID_WORK"); cleanBrokerWork(qpidWork); @@ -333,17 +293,7 @@ public class QpidBrokerTestCase extends QpidTestCase _logger.info("========== stop " + getTestName() + " =========="); - if (redirected) - { - System.setErr(oldErr); - System.setOut(oldOut); - err.close(); - out.close(); - if (!_interleaveBrokerLog) - { - _testcaseOutputStream.close(); - } - } + LogManager.resetConfiguration(); } } @@ -403,7 +353,7 @@ public class QpidBrokerTestCase extends QpidTestCase protected int getPort(int port) { - if (!_brokerType.equals(BrokerType.EXTERNAL)) + if (!_brokerType.equals(BrokerHolder.BrokerType.EXTERNAL)) { return port == 0 ? DEFAULT_PORT : port; } @@ -425,28 +375,33 @@ public class QpidBrokerTestCase extends QpidTestCase public void startBroker(int port, boolean managementMode) throws Exception { + startBroker(port, managementMode, null); + } + + public void startBroker(int port, boolean managementMode, String log4jFile) throws Exception + { int actualPort = getPort(port); TestBrokerConfiguration configuration = getBrokerConfiguration(actualPort); - startBroker(actualPort, configuration, managementMode); + startBroker(actualPort, configuration, managementMode, log4jFile); } protected File getBrokerCommandLog4JFile() { - return _logConfigFile; + return _spawnedBrokerLogConfigFile; } protected void setBrokerCommandLog4JFile(File file) { - _logConfigFile = file; + _spawnedBrokerLogConfigFile = file; _logger.info("Modified log config file to: " + file); } - public void startBroker(int port, TestBrokerConfiguration testConfiguration) throws Exception + public void startBroker(int port, TestBrokerConfiguration testConfiguration, String log4jFile) throws Exception { - startBroker(port, testConfiguration, false); + startBroker(port, testConfiguration, false, log4jFile); } - public void startBroker(int port, TestBrokerConfiguration testConfiguration, boolean managementMode) throws Exception + protected void startBroker(int port, TestBrokerConfiguration testConfiguration, boolean managementMode, String log4jFile) throws Exception { port = getPort(port); @@ -455,181 +410,12 @@ public class QpidBrokerTestCase extends QpidTestCase throw new IllegalStateException("There is already an existing broker running on port " + port); } - Set<Integer> portsUsedByBroker = guessAllPortsUsedByBroker(port); String testConfig = saveTestConfiguration(port, testConfiguration); - - if (_brokerType.equals(BrokerType.INTERNAL) && !existingInternalBroker()) - { - setSystemProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, "false"); - BrokerOptions options = new BrokerOptions(); - - options.setConfigurationStoreType(_brokerStoreType); - options.setConfigurationStoreLocation(testConfig); - options.setManagementMode(managementMode); - if (managementMode) - { - options.setManagementModePassword(MANAGEMENT_MODE_PASSWORD); - } - - //Set the log config file, relying on the log4j.configuration system property - //set on the JVM by the JUnit runner task in module.xml. - options.setLogConfigFileLocation(_logConfigFile.getAbsolutePath()); - - Broker broker = new Broker(); - _logger.info("Starting internal broker (same JVM)"); - broker.startup(options); - - _brokers.put(port, new InternalBrokerHolder(broker, System.getProperty("QPID_WORK"), portsUsedByBroker)); - } - else if (!_brokerType.equals(BrokerType.EXTERNAL)) - { - // Add the port to QPID_WORK to ensure unique working dirs for multi broker tests - final String qpidWork = getQpidWork(_brokerType, port); - - String[] cmd = _brokerCommandHelper.getBrokerCommand(port, testConfig, _brokerStoreType, _logConfigFile); - if (managementMode) - { - String[] newCmd = new String[cmd.length + 3]; - System.arraycopy(cmd, 0, newCmd, 0, cmd.length); - newCmd[cmd.length] = "-mm"; - newCmd[cmd.length + 1] = "-mmpass"; - newCmd[cmd.length + 2] = MANAGEMENT_MODE_PASSWORD; - cmd = newCmd; - } - _logger.info("Starting spawn broker using command: " + StringUtils.join(cmd, ' ')); - ProcessBuilder pb = new ProcessBuilder(cmd); - pb.redirectErrorStream(true); - Map<String, String> processEnv = pb.environment(); - String qpidHome = System.getProperty(QPID_HOME); - processEnv.put(QPID_HOME, qpidHome); - //Augment Path with bin directory in QPID_HOME. - boolean foundPath = false; - final String pathEntry = qpidHome + File.separator + "bin"; - for(Map.Entry<String,String> entry : processEnv.entrySet()) - { - if(entry.getKey().equalsIgnoreCase("path")) - { - entry.setValue(entry.getValue().concat(File.pathSeparator + pathEntry)); - foundPath = true; - } - } - if(!foundPath) - { - processEnv.put("PATH", pathEntry); - - } - //Add the test name to the broker run. - // DON'T change PNAME, qpid.stop needs this value. - processEnv.put("QPID_PNAME", "-DPNAME=QPBRKR -DTNAME=\"" + getTestName() + "\""); - processEnv.put("QPID_WORK", qpidWork); - - // Use the environment variable to set amqj.logging.level for the broker - // The value used is a 'server' value in the test configuration to - // allow a differentiation between the client and broker logging levels. - if (System.getProperty("amqj.server.logging.level") != null) - { - setBrokerEnvironment("AMQJ_LOGGING_LEVEL", System.getProperty("amqj.server.logging.level")); - } - - // Add all the environment settings the test requested - if (!_env.isEmpty()) - { - for (Map.Entry<String, String> entry : _env.entrySet()) - { - processEnv.put(entry.getKey(), entry.getValue()); - } - } - - String qpidOpts = ""; - - // a synchronized hack to avoid adding into QPID_OPTS the values - // of JVM properties "test.virtualhosts" and "test.config" set by a concurrent startup process - synchronized (_propertiesSetForBroker) - { - // Add default test logging levels that are used by the log4j-test - // Use the convenience methods to push the current logging setting - // in to the external broker's QPID_OPTS string. - setSystemProperty("amqj.protocol.logging.level"); - setSystemProperty("root.logging.level"); - - setSystemProperty("test.port"); - setSystemProperty("test.mport"); - setSystemProperty("test.cport"); - setSystemProperty("test.hport"); - setSystemProperty("test.hsport"); - setSystemProperty("test.port.ssl"); - setSystemProperty("test.port.alt"); - setSystemProperty("test.port.alt.ssl"); - setSystemProperty("test.amqp_port_protocols"); - - setSystemProperty("virtualhostnode.type"); - setSystemProperty("virtualhostnode.context.blueprint"); - - // Add all the specified system properties to QPID_OPTS - if (!_propertiesSetForBroker.isEmpty()) - { - for (String key : _propertiesSetForBroker.keySet()) - { - qpidOpts += " -D" + key + "=" + _propertiesSetForBroker.get(key); - } - } - } - if (processEnv.containsKey("QPID_OPTS")) - { - qpidOpts = processEnv.get("QPID_OPTS") + qpidOpts; - } - processEnv.put("QPID_OPTS", qpidOpts); - - // cpp broker requires that the work directory is created - createBrokerWork(qpidWork); - - Process process = pb.start(); - - Piper p = new Piper(process.getInputStream(), - _testcaseOutputStream, - System.getProperty(BROKER_READY), - System.getProperty(BROKER_STOPPED), - _interleaveBrokerLog ? _brokerLogPrefix : null); - - p.start(); - StringBuilder cmdLine = new StringBuilder(cmd[0]); - for(int i = 1; i< cmd.length; i++) - { - cmdLine.append(' '); - cmdLine.append(cmd[i]); - } - - SpawnedBrokerHolder holder = new SpawnedBrokerHolder(process, qpidWork, portsUsedByBroker, cmdLine.toString()); - if (!p.await(30, TimeUnit.SECONDS)) - { - _logger.info("broker failed to become ready (" + p.getReady() + "):" + p.getStopLine()); - String threadDump = holder.dumpThreads(); - if (!threadDump.isEmpty()) - { - _logger.info("the result of a try to capture thread dump:" + threadDump); - } - //Ensure broker has stopped - process.destroy(); - cleanBrokerWork(qpidWork); - throw new RuntimeException("broker failed to become ready:" - + p.getStopLine()); - } - - try - { - //test that the broker is still running and hasn't exited unexpectedly - int exit = process.exitValue(); - _logger.info("broker aborted: " + exit); - cleanBrokerWork(qpidWork); - throw new RuntimeException("broker aborted: " + exit); - } - catch (IllegalThreadStateException e) - { - // this is expect if the broker started successfully - } - - _brokers.put(port, holder); - } + String log4jConfig = log4jFile == null ? getBrokerCommandLog4JFile().getAbsolutePath() : log4jFile; + BrokerOptions options = getBrokerOptions(managementMode, testConfig, log4jConfig, log4jFile == null); + BrokerHolder holder = new BrokerHolderFactory().create(_brokerType, port, this); + _brokers.put(port, holder); + holder.start(options); } private boolean existingInternalBroker() @@ -645,21 +431,6 @@ public class QpidBrokerTestCase extends QpidTestCase return false; } - private String getQpidWork(BrokerType broker, int port) - { - if (!broker.equals(BrokerType.EXTERNAL)) - { - return System.getProperty("QPID_WORK")+ "/" + port; - } - - return System.getProperty("QPID_WORK"); - } - - public String getTestConfigFile() - { - return getTestConfigFile(getPort()); - } - public String getTestConfigFile(int port) { return _output + File.separator + getTestQueueName() + "-" + port + "-config"; @@ -1035,7 +806,7 @@ public class QpidBrokerTestCase extends QpidTestCase protected boolean isInternalBroker() { - return _brokerType.equals(BrokerType.INTERNAL); + return _brokerType.equals(BrokerHolder.BrokerType.INTERNAL); } protected boolean isBrokerStorePersistent() @@ -1397,16 +1168,6 @@ public class QpidBrokerTestCase extends QpidTestCase return message; } - protected int getMessageSize() - { - return _messageSize; - } - - protected void setMessageSize(int byteSize) - { - _messageSize = byteSize; - } - public BrokerDetails getBroker() { try @@ -1453,4 +1214,91 @@ public class QpidBrokerTestCase extends QpidTestCase session.commit(); session.close(); } + + protected BrokerOptions getBrokerOptions( boolean managementMode, String testConfig, String log4jConfig, boolean skipLoggingConfiguration) + { + BrokerOptions options = new BrokerOptions(); + + options.setConfigurationStoreType(_brokerStoreType); + options.setConfigurationStoreLocation(testConfig); + options.setManagementMode(managementMode); + if (managementMode) + { + options.setManagementModePassword(MANAGEMENT_MODE_PASSWORD); + } + options.setSkipLoggingConfiguration(skipLoggingConfiguration); + options.setLogConfigFileLocation(log4jConfig); + options.setStartupLoggedToSystemOut(false); + return options; + } + + private Map<String, String> getJvmProperties() + { + Map<String,String> jvmOptions = new HashMap(); + synchronized (_propertiesSetForBroker) + { + jvmOptions.putAll(_propertiesSetForBroker); + + copySystemProperty("amqj.protocol.logging.level", jvmOptions); + copySystemProperty("root.logging.level", jvmOptions); + + copySystemProperty("test.port", jvmOptions); + copySystemProperty("test.mport", jvmOptions); + copySystemProperty("test.cport", jvmOptions); + copySystemProperty("test.hport", jvmOptions); + copySystemProperty("test.hsport", jvmOptions); + copySystemProperty("test.port.ssl", jvmOptions); + copySystemProperty("test.port.alt", jvmOptions); + copySystemProperty("test.port.alt.ssl", jvmOptions); + copySystemProperty("test.amqp_port_protocols", jvmOptions); + + copySystemProperty("virtualhostnode.type", jvmOptions); + copySystemProperty("virtualhostnode.context.blueprint", jvmOptions); + } + return jvmOptions; + } + + private void copySystemProperty(String name, Map<String, String> jvmOptions) + { + String value = System.getProperty(name); + if (value != null) + { + jvmOptions.put(name, value); + } + } + + private Map<String, String> getEnvironmentProperties() + { + return new HashMap<>(_env); + } + + private String getBrokerCommandTemplate() + { + return _brokerCommandTemplate; + } + + public static class BrokerHolderFactory + { + + public BrokerHolder create(BrokerHolder.BrokerType brokerType, int port, QpidBrokerTestCase testCase) + { + Set<Integer> portsUsedByBroker = testCase.guessAllPortsUsedByBroker(port); + BrokerHolder holder = null; + if (brokerType.equals(BrokerHolder.BrokerType.INTERNAL) && !testCase.existingInternalBroker()) + { + testCase.setSystemProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, "false"); + holder = new InternalBrokerHolder(portsUsedByBroker); + } + else if (!brokerType.equals(BrokerHolder.BrokerType.EXTERNAL)) + { + + Map<String,String> jvmOptions = testCase.getJvmProperties(); + Map<String,String> environmentProperties = testCase.getEnvironmentProperties(); + + holder = new SpawnedBrokerHolder(testCase.getBrokerCommandTemplate(), port, testCase.getTestName(), jvmOptions, environmentProperties, brokerType, portsUsedByBroker); + } + return holder; + } + } + } diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java index 4b747e869c..2581093f97 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/SpawnedBrokerHolder.java @@ -22,6 +22,7 @@ package org.apache.qpid.test.utils; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -30,39 +31,215 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; +import org.apache.qpid.server.BrokerOptions; +import org.apache.qpid.server.configuration.BrokerProperties; +import org.apache.qpid.server.logging.messages.BrokerMessages; +import org.apache.qpid.util.FileUtils; import org.apache.qpid.util.SystemUtils; public class SpawnedBrokerHolder implements BrokerHolder { private static final Logger LOGGER = Logger.getLogger(SpawnedBrokerHolder.class); + protected static final String BROKER_READY = System.getProperty("broker.ready", BrokerMessages.READY().toString()); + private static final String BROKER_STOPPED = System.getProperty("broker.stopped", BrokerMessages.STOPPED().toString()); - private final Process _process; - private final Integer _pid; - private final String _workingDirectory; + private final BrokerType _type; + private final int _port; + private final String _name; + private final Map<String, String> _jvmOptions; + private final Map<String, String> _environmentSettings; + protected BrokerCommandHelper _brokerCommandHelper; + + private Process _process; + private Integer _pid; private Set<Integer> _portsUsedByBroker; - private final String _brokerCommand; + private String _brokerCommand; + + public SpawnedBrokerHolder(String brokerCommandTemplate, int port, String name, Map<String, String> jvmOptions, Map<String, String> environmentSettings, BrokerType type, Set<Integer> portsUsedByBroker) + { + _type = type; + _portsUsedByBroker = portsUsedByBroker; + _port = port; + _name = name; + _jvmOptions = jvmOptions; + _environmentSettings = environmentSettings; + _brokerCommandHelper = new BrokerCommandHelper(brokerCommandTemplate); + } - public SpawnedBrokerHolder(final Process process, final String workingDirectory, Set<Integer> portsUsedByBroker, - String brokerCmd) + + @Override + public void start(BrokerOptions brokerOptions) throws Exception { - if(process == null) + // Add the port to QPID_WORK to ensure unique working dirs for multi broker tests + final String qpidWork = getQpidWork(_type, _port); + + String[] cmd = _brokerCommandHelper.getBrokerCommand(_port, brokerOptions.getConfigurationStoreLocation(), brokerOptions.getConfigurationStoreType(), + new File(brokerOptions.getLogConfigFileLocation())); + if (brokerOptions.isManagementMode()) + { + String[] newCmd = new String[cmd.length + 3]; + System.arraycopy(cmd, 0, newCmd, 0, cmd.length); + newCmd[cmd.length] = "-mm"; + newCmd[cmd.length + 1] = "-mmpass"; + newCmd[cmd.length + 2] = brokerOptions.getManagementModePassword(); + cmd = newCmd; + } + ProcessBuilder pb = new ProcessBuilder(cmd); + pb.redirectErrorStream(true); + Map<String, String> processEnv = pb.environment(); + String qpidHome = System.getProperty(BrokerProperties.PROPERTY_QPID_HOME); + processEnv.put(BrokerProperties.PROPERTY_QPID_HOME, qpidHome); + + //Augment Path with bin directory in QPID_HOME. + boolean foundPath = false; + final String pathEntry = qpidHome + File.separator + "bin"; + for(Map.Entry<String,String> entry : processEnv.entrySet()) + { + if(entry.getKey().equalsIgnoreCase("path")) + { + entry.setValue(entry.getValue().concat(File.pathSeparator + pathEntry)); + foundPath = true; + } + } + if(!foundPath) + { + processEnv.put("PATH", pathEntry); + } + //Add the test name to the broker run. + // DON'T change PNAME, qpid.stop needs this value. + processEnv.put("QPID_PNAME", "-DPNAME=QPBRKR -DTNAME=\"" + _name + "\""); + processEnv.put("QPID_WORK", qpidWork); + + // Use the environment variable to set amqj.logging.level for the broker + // The value used is a 'server' value in the test configuration to + // allow a differentiation between the client and broker logging levels. + if (System.getProperty("amqj.server.logging.level") != null) + { + processEnv.put("AMQJ_LOGGING_LEVEL", System.getProperty("amqj.server.logging.level")); + } + + // Add all the environment settings the test requested + if (!_environmentSettings.isEmpty()) + { + for (Map.Entry<String, String> entry : _environmentSettings.entrySet()) + { + processEnv.put(entry.getKey(), entry.getValue()); + } + } + + String qpidOpts = ""; + + // Add all the specified system properties to QPID_OPTS + if (!_jvmOptions.isEmpty()) { - throw new IllegalArgumentException("Process must not be null"); + for (String key : _jvmOptions.keySet()) + { + qpidOpts += " -D" + key + "=" + _jvmOptions.get(key); + } } - _process = process; + if (processEnv.containsKey("QPID_OPTS")) + { + qpidOpts = processEnv.get("QPID_OPTS") + qpidOpts; + } + processEnv.put("QPID_OPTS", qpidOpts); + + // cpp broker requires that the work directory is created + createBrokerWork(qpidWork); + + _process = pb.start(); + + Piper standardOutputPiper = new Piper(_process.getInputStream(), + BROKER_READY, + BROKER_STOPPED, + "STD", "BROKER-" + _port); + + standardOutputPiper.start(); + + new Piper(_process.getErrorStream(), null, null, "ERROR", "BROKER-" + _port).start(); + + StringBuilder cmdLine = new StringBuilder(cmd[0]); + for(int i = 1; i< cmd.length; i++) + { + cmdLine.append(' '); + cmdLine.append(cmd[i]); + } + + _brokerCommand = cmdLine.toString(); _pid = retrieveUnixPidIfPossible(); - _workingDirectory = workingDirectory; - _portsUsedByBroker = portsUsedByBroker; - _brokerCommand = brokerCmd; + + if (!standardOutputPiper.await(30, TimeUnit.SECONDS)) + { + LOGGER.info("broker failed to become ready (" + standardOutputPiper.getReady() + "):" + standardOutputPiper.getStopLine()); + String threadDump = dumpThreads(); + if (!threadDump.isEmpty()) + { + LOGGER.info("the result of a try to capture thread dump:" + threadDump); + } + //Ensure broker has stopped + _process.destroy(); + cleanBrokerWork(qpidWork); + throw new RuntimeException("broker failed to become ready:" + + standardOutputPiper.getStopLine()); + } + + try + { + //test that the broker is still running and hasn't exited unexpectedly + int exit = _process.exitValue(); + LOGGER.info("broker aborted: " + exit); + cleanBrokerWork(qpidWork); + throw new RuntimeException("broker aborted: " + exit); + } + catch (IllegalThreadStateException e) + { + // this is expect if the broker started successfully + } + } - @Override - public String getWorkingDirectory() + protected void createBrokerWork(final String qpidWork) { - return _workingDirectory; + if (qpidWork != null) + { + final File dir = new File(qpidWork); + dir.mkdirs(); + if (!dir.isDirectory()) + { + throw new RuntimeException("Failed to created Qpid work directory : " + qpidWork); + } + } + } + + private String getQpidWork(BrokerType broker, int port) + { + if (!broker.equals(BrokerType.EXTERNAL)) + { + return System.getProperty(BrokerProperties.PROPERTY_QPID_WORK) + File.separator + port; + } + + return System.getProperty(BrokerProperties.PROPERTY_QPID_WORK); + } + + private void cleanBrokerWork(final String qpidWork) + { + if (qpidWork != null) + { + LOGGER.info("Cleaning broker work dir: " + qpidWork); + + File file = new File(qpidWork); + if (file.exists()) + { + final boolean success = FileUtils.delete(file, true); + if(!success) + { + throw new RuntimeException("Failed to recursively delete beneath : " + file); + } + } + } } public void shutdown() diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java index e267bf439b..c475432113 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/server/BrokerStartupTest.java @@ -77,7 +77,7 @@ public class BrokerStartupTest extends AbstractTestLogging brokerConfigFile.delete(); } - startBroker(port, null); + startBroker(port, null, null); AMQConnectionURL url = new AMQConnectionURL(String.format("amqp://" + GUEST_USERNAME @@ -209,7 +209,7 @@ public class BrokerStartupTest extends AbstractTestLogging brokerConfigFile.delete(); } - startBroker(port, null); + startBroker(port, null, null); AMQConnectionURL url = new AMQConnectionURL(String.format("amqp://" + GUEST_USERNAME diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/server/logging/BrokerLoggingTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/server/logging/BrokerLoggingTest.java index 4952c4e10e..f7953e56d1 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/server/logging/BrokerLoggingTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/server/logging/BrokerLoggingTest.java @@ -22,13 +22,15 @@ package org.apache.qpid.server.logging; import junit.framework.AssertionFailedError; -import org.apache.qpid.server.BrokerOptions; +import org.apache.log4j.FileAppender; +import org.apache.log4j.LogManager; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.Transport; import org.apache.qpid.test.utils.TestBrokerConfiguration; import org.apache.qpid.transport.ConnectionException; import org.apache.qpid.util.LogMonitor; +import java.io.File; import java.io.IOException; import java.net.Socket; import java.util.Collections; @@ -59,6 +61,7 @@ public class BrokerLoggingTest extends AbstractTestLogging private static final Pattern BROKER_MESSAGE_LOG_PATTERN = Pattern.compile(BROKER_MESSAGE_LOG_REG_EXP); private static final String BRK_LOG_PREFIX = "BRK-"; + @Override public void setUp() throws Exception { setLogMessagePrefix(); @@ -146,94 +149,6 @@ public class BrokerLoggingTest extends AbstractTestLogging /** * Description: - * On startup the broker must report correctly report the log4j file in use. This is important as it can help diagnose why logging messages are not being reported. - * Input: - * No custom -l value should be provided on the command line so that the default value is correctly reported. - * Output: - * - * <date> MESSAGE BRK-1007 : Using logging configuration : <$QPID_HOME>/etc/log4j.xml - * - * Validation Steps: - * - * 1. The BRK ID is correct - * 2. This occurs before the BRK-1001 startup message. - * 3. The log4j file is the full path to the file specified on the commandline. - * - * @throws Exception caused by broker startup - */ - public void testBrokerStartupDefaultLog4j() throws Exception - { - if (isJavaBroker() && isExternalBroker() && !isInternalBroker()) - { - String TESTID = "BRK-1007"; - - _brokerCommandHelper.removeBrokerCommandLog4JFile(); - - startBroker(); - - // Now we can create the monitor as _outputFile will now be defined - _monitor = new LogMonitor(_outputFile); - - // Ensure broker has fully started up. - getConnection(); - - // Ensure we wait for TESTID to be logged - waitAndFindMatches(TESTID); - - List<String> results = waitAndFindMatches(BRK_LOG_PREFIX); - try - { - // Validation - - assertTrue("BRKer message not logged", results.size() > 0); - - boolean validation = false; - for (String rawLog : results) - { - // We don't care about messages after we have our log config - if (validation) - { - break; - } - - String log = getLog(rawLog); - - // Ensure we do not have a BRK-1001 message before - if (!getMessageID(log).equals(TESTID)) - { - assertFalse(getMessageID(log).equals("BRK-1001")); - continue; - } - - //1 - validateMessageID(TESTID, log); - - //2 - //There will be 1 copy of this startup message (via SystemOut) - assertEquals("Unexpected log4j configuration message count.", - 1, findMatches(TESTID).size()); - - //3 - String defaultLog4j = System.getProperty(QPID_HOME) + "/" + BrokerOptions.DEFAULT_LOG_CONFIG_FILE; - assertTrue("Log4j file(" + defaultLog4j + ") details not correctly logged:" + getMessageString(log), - getMessageString(log).endsWith(defaultLog4j)); - - validation = true; - } - - assertTrue("Validation not performed: " + TESTID + " not logged", validation); - } - catch (AssertionFailedError afe) - { - dumpLogs(results, _monitor); - - throw afe; - } - } - } - - /** - * Description: * On startup the broker must report correctly report the log4j file in use. This is important as it can help diagnose why logging messages are not being reported. The broker must also be capable of correctly recognising the command line property to specify the custom logging configuration. * Input: * The value of -l specified on the command line. @@ -254,11 +169,17 @@ public class BrokerLoggingTest extends AbstractTestLogging // This logging startup code only occurs when you run a Java broker if (isJavaBroker()) { - String customLog4j = getBrokerCommandLog4JFile().getAbsolutePath(); + // Log4j properties expects this to be set + System.setProperty("qpid.testMethod", "-" + getName() + ".customLog4j"); + System.setProperty("qpid.testClass", getClass().getName() ); + + String customLog4j = System.getProperty("log4j.configuration.file"); String TESTID = "BRK-1007"; - startBroker(); + startBroker(0, false, customLog4j); + _outputFile = new File(((FileAppender) LogManager.getRootLogger().getAllAppenders().nextElement()).getFile()); + // Now we can create the monitor as _outputFile will now be defined _monitor = new LogMonitor(_outputFile); @@ -385,7 +306,7 @@ public class BrokerLoggingTest extends AbstractTestLogging //2 //There will be 2 copies of the startup message (one via SystemOut, and one via Log4J) assertEquals("Unexpected startup message count", - 2, findMatches(TESTID).size()); + 1, findMatches(TESTID).size()); validation = true; } @@ -471,9 +392,8 @@ public class BrokerLoggingTest extends AbstractTestLogging assertEquals("Incorrect message", TESTID, id); //2 - //There will be 2 copies of the startup message (one via SystemOut, and one via Log4J) assertEquals("Unexpected listen message count", - 2, findMatches(TESTID).size()); + 1, findMatches(TESTID).size()); //3 String message = getMessageString(log); @@ -587,7 +507,7 @@ public class BrokerLoggingTest extends AbstractTestLogging //There will be 4 copies of the startup message (two via SystemOut, and two via Log4J) List<String> listenMessages = findMatches(TESTID); assertEquals("Four listen messages should be found.", - 4, listenMessages .size()); + 2, listenMessages .size()); int tcpStarted = 0; int sslStarted = 0; @@ -604,8 +524,8 @@ public class BrokerLoggingTest extends AbstractTestLogging } } - assertEquals("Unexpected number of logs 'Listening on TCP port'", 2, tcpStarted); - assertEquals("Unexpected number of logs 'Listening on SSL port'", 2, sslStarted); + assertEquals("Unexpected number of logs 'Listening on TCP port'", 1, tcpStarted); + assertEquals("Unexpected number of logs 'Listening on SSL port'", 1, sslStarted); //4 Test ports open testSocketOpen(getPort()); @@ -690,10 +610,9 @@ public class BrokerLoggingTest extends AbstractTestLogging //2 assertEquals("Ready message not present", "Qpid Broker Ready", getMessageString(log)); - //There will be 2 copies of the startup message (one via SystemOut, and one via Log4J) assertEquals("Unexpected ready message count", - 2, findMatches(TESTID).size()); - assertEquals("The ready messages should have been the last 2 messages", results.size() - 2, i); + 1, findMatches(TESTID).size()); + assertEquals("The ready messages should have been the last 2 messages", results.size() - 1, i); validationComplete = true; break; diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java b/qpid/java/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java index 789ad420d8..f7722a8384 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java @@ -59,7 +59,7 @@ public abstract class AbstractACLTestCase extends QpidBrokerTestCase implements @Override public void setUp() throws Exception { - getBrokerConfiguration().addGroupFileConfiguration(System.getProperty(QPID_HOME) + "/etc/groups-systests"); + getBrokerConfiguration().addGroupFileConfiguration(QPID_HOME + "/etc/groups-systests"); // run test specific setup String testSetup = StringUtils.replace(getName(), "test", "setUp"); diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/LoggingManagementTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/LoggingManagementTest.java index 3717c1594d..a06ed7be52 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/LoggingManagementTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/LoggingManagementTest.java @@ -25,6 +25,7 @@ import javax.management.openmbean.CompositeData; import javax.management.openmbean.TabularData; import org.apache.qpid.management.common.mbeans.LoggingManagement; +import org.apache.qpid.server.configuration.BrokerProperties; import org.apache.qpid.server.logging.log4j.LoggingManagementFacadeTest; import org.apache.qpid.test.utils.JMXTestUtils; import org.apache.qpid.test.utils.QpidBrokerTestCase; @@ -35,7 +36,6 @@ import org.apache.qpid.util.LogMonitor; * System test for Logging Management. <b>These tests rely on value set within * test-profiles/log4j-test.xml</b>. * - * @see LoggingManagementMBeanTest * @see LoggingManagementFacadeTest * */ @@ -44,7 +44,9 @@ public class LoggingManagementTest extends QpidBrokerTestCase private JMXTestUtils _jmxUtils; private LoggingManagement _loggingManagement; private LogMonitor _monitor; + private File _logConfig; + @Override public void setUp() throws Exception { getBrokerConfiguration().addJmxManagementConfiguration(); @@ -56,8 +58,9 @@ public class LoggingManagementTest extends QpidBrokerTestCase File tmpLogFile = File.createTempFile("log4j" + "." + getName(), ".xml"); tmpLogFile.deleteOnExit(); - FileUtils.copy(getBrokerCommandLog4JFile(), tmpLogFile); + FileUtils.copy(new File(System.getProperty("log4j.configuration.file")), tmpLogFile); setBrokerCommandLog4JFile(tmpLogFile); + _logConfig = tmpLogFile; super.setUp(); _jmxUtils.open(); @@ -66,6 +69,12 @@ public class LoggingManagementTest extends QpidBrokerTestCase _monitor = new LogMonitor(_outputFile); } + public void startBroker() throws Exception + { + super.startBroker(0, false, _logConfig.getAbsolutePath()); + } + + @Override public void tearDown() throws Exception { try @@ -74,6 +83,11 @@ public class LoggingManagementTest extends QpidBrokerTestCase { _jmxUtils.close(); } + + if (_logConfig != null) + { + _logConfig.delete(); + } } finally { @@ -122,7 +136,7 @@ public class LoggingManagementTest extends QpidBrokerTestCase _loggingManagement.setConfigFileLoggerLevel(operationalLoggingLogger, "OFF"); List<String> matches = _monitor.waitAndFindMatches("Setting level to OFF for logger 'qpid.message'", 5000); - assertEquals(1, matches.size()); + assertTrue(matches.size()>=1); assertEffectiveLoggingLevel(operationalLoggingLogger, "INFO"); diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java index cb6eae013e..4df81845d8 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/management/jmx/ManagementLoggingTest.java @@ -104,7 +104,7 @@ public class ManagementLoggingTest extends AbstractTestLogging //There will be 2 copies of the startup message (one via SystemOut, and one via Log4J) results = findMatches("MNG-1001"); assertEquals("Unexpected startup message count.", - 2, results.size()); + 1, results.size()); //3 assertEquals("Startup log message is not 'Startup'.", "JMX Management Startup", @@ -185,7 +185,7 @@ public class ManagementLoggingTest extends AbstractTestLogging // Validation //There will be 4 startup messages (two via SystemOut, and two via Log4J) - assertEquals("Unexpected MNG-1002 message count", 4, results.size()); + assertEquals("Unexpected MNG-1002 message count", 2, results.size()); String log = getLogMessage(results, 0); @@ -197,7 +197,7 @@ public class ManagementLoggingTest extends AbstractTestLogging assertTrue("RMI Registry port not as expected(" + mPort + ").:" + getMessageString(log), getMessageString(log).endsWith(String.valueOf(mPort))); - log = getLogMessage(results, 2); + log = getLogMessage(results, 1); //1 validateMessageID("MNG-1002", log); @@ -243,7 +243,7 @@ public class ManagementLoggingTest extends AbstractTestLogging // Validate we only have two MNG-1002 (one via stdout, one via log4j) results = findMatches("MNG-1006"); assertEquals("Upexpected SSL Keystore message count", - 2, results.size()); + 1, results.size()); // Validate the keystore path is as expected assertTrue("SSL Keystore entry expected.:" + getMessageString(log), diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java index 4b881d1e9f..169ece986e 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/KeyStoreRestTest.java @@ -56,7 +56,7 @@ public class KeyStoreRestTest extends QpidRestTestCase Map<String, Object> keystore = keyStores.get(0); assertKeyStoreAttributes(keystore, TestBrokerConfiguration.ENTRY_NAME_SSL_KEYSTORE, - System.getProperty(QPID_HOME) + "/../" + TestSSLConstants.BROKER_KEYSTORE, null); + QPID_HOME + "/../" + TestSSLConstants.BROKER_KEYSTORE, null); } public void testCreate() throws Exception @@ -98,7 +98,7 @@ public class KeyStoreRestTest extends QpidRestTestCase List<Map<String, Object>> keyStores = assertNumberOfKeyStores(1); Map<String, Object> keystore = keyStores.get(0); assertKeyStoreAttributes(keystore, TestBrokerConfiguration.ENTRY_NAME_SSL_KEYSTORE, - System.getProperty(QPID_HOME) + "/../" + TestSSLConstants.BROKER_KEYSTORE, null); + QPID_HOME + "/../" + TestSSLConstants.BROKER_KEYSTORE, null); } public void testDeleteFailsWhenKeyStoreInUse() throws Exception diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/LogViewerTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/LogViewerTest.java index f2fb2581f7..a7bf743e72 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/LogViewerTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/LogViewerTest.java @@ -28,25 +28,40 @@ import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import org.apache.qpid.server.BrokerOptions; +import org.apache.log4j.FileAppender; +import org.apache.log4j.Logger; +import org.apache.log4j.SimpleLayout; +import org.apache.qpid.server.configuration.BrokerProperties; public class LogViewerTest extends QpidRestTestCase { - public static final String DEFAULT_FILE_APPENDER_NAME = "FileAppender"; private String _expectedLogFileName; + private FileAppender _fileAppender; + private String _appenderName; + @Override public void setUp() throws Exception { - setSystemProperty("logsuffix", "-" + getTestQueueName()); - _expectedLogFileName = System.getProperty("logprefix", "") + "qpid" + System.getProperty("logsuffix", "") + ".log"; - - // use real broker log file - File brokerLogFile = new File(System.getProperty(QPID_HOME), BrokerOptions.DEFAULT_LOG_CONFIG_FILE); - setBrokerCommandLog4JFile(brokerLogFile); + _appenderName = getTestQueueName(); + _expectedLogFileName = "qpid-" + _appenderName + ".log"; + _fileAppender = new FileAppender(new SimpleLayout(), + System.getProperty(BrokerProperties.PROPERTY_QPID_WORK) + File.separator + _expectedLogFileName, false); + _fileAppender.setName(_appenderName); + Logger.getRootLogger().addAppender(_fileAppender); super.setUp(); } + @Override + public void tearDown() throws Exception + { + if (_fileAppender != null) + { + Logger.getRootLogger().removeAppender(_fileAppender); + } + super.tearDown(); + } + public void testGetLogFiles() throws Exception { List<Map<String, Object>> logFiles = getRestTestHelper().getJsonAsList("/service/logfilenames"); @@ -54,24 +69,32 @@ public class LogViewerTest extends QpidRestTestCase // 1 file appender is configured in QPID default log4j xml: assertTrue("Unexpected number of log files", logFiles.size() > 0); + Map<String, Object> logFileDetails = null; + for (Map<String, Object> appenderDetails: logFiles) + { + if (_appenderName.equals(appenderDetails.get("appenderName"))) + { + logFileDetails = appenderDetails; + break; + } + } - Map<String, Object> logFileDetails = logFiles.get(0); assertEquals("Unexpected log file name", _expectedLogFileName, logFileDetails.get("name")); assertEquals("Unexpected log file mime type", "text/plain", logFileDetails.get("mimeType")); - assertEquals("Unexpected log file appender",DEFAULT_FILE_APPENDER_NAME, logFileDetails.get("appenderName")); + assertEquals("Unexpected log file appender",_appenderName, logFileDetails.get("appenderName")); assertTrue("Unexpected log file size", ((Number)logFileDetails.get("size")).longValue()>0); assertTrue("Unexpected log file modification time", ((Number)logFileDetails.get("lastModified")).longValue()>0); } public void testDownloadExistingLogFiles() throws Exception { - byte[] bytes = getRestTestHelper().getBytes("/service/logfile?l=" + DEFAULT_FILE_APPENDER_NAME + "%2F" + _expectedLogFileName); + byte[] bytes = getRestTestHelper().getBytes("/service/logfile?l=" + _appenderName + "%2F" + _expectedLogFileName); ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(bytes)); try { ZipEntry entry = zis.getNextEntry(); - assertEquals("Unexpected broker log file name", DEFAULT_FILE_APPENDER_NAME + "/" + _expectedLogFileName, entry.getName()); + assertEquals("Unexpected broker log file name", _appenderName + "/" + _expectedLogFileName, entry.getName()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len; @@ -91,7 +114,7 @@ public class LogViewerTest extends QpidRestTestCase public void testDownloadNonExistingLogFiles() throws Exception { - int responseCode = getRestTestHelper().submitRequest("/service/logfile?l=" + DEFAULT_FILE_APPENDER_NAME + "%2F" + int responseCode = getRestTestHelper().submitRequest("/service/logfile?l=" + _appenderName + "%2F" + _expectedLogFileName + "_" + System.currentTimeMillis(), "GET"); assertEquals("Unexpected response code", 404, responseCode); diff --git a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java index 5d2e9de3fa..1aac22d0aa 100644 --- a/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java +++ b/qpid/java/systests/src/test/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java @@ -56,7 +56,7 @@ public class TrustStoreRestTest extends QpidRestTestCase Map<String, Object> truststore = trustStores.get(0); assertTrustStoreAttributes(truststore, TestBrokerConfiguration.ENTRY_NAME_SSL_TRUSTSTORE, - System.getProperty(QPID_HOME) + "/../" + TestSSLConstants.BROKER_TRUSTSTORE, false); + QPID_HOME + "/../" + TestSSLConstants.BROKER_TRUSTSTORE, false); } public void testCreate() throws Exception @@ -96,7 +96,7 @@ public class TrustStoreRestTest extends QpidRestTestCase List<Map<String, Object>> trustStores = assertNumberOfTrustStores(1); Map<String, Object> truststore = trustStores.get(0); assertTrustStoreAttributes(truststore, TestBrokerConfiguration.ENTRY_NAME_SSL_TRUSTSTORE, - System.getProperty(QPID_HOME) + "/../" + TestSSLConstants.BROKER_TRUSTSTORE, false); + QPID_HOME + "/../" + TestSSLConstants.BROKER_TRUSTSTORE, false); } public void testDeleteFailsWhenTrustStoreInUse() throws Exception diff --git a/qpid/java/test-profiles/test_resources/log4j.xml b/qpid/java/test-profiles/test_resources/log4j.xml new file mode 100644 index 0000000000..8c59ffdd98 --- /dev/null +++ b/qpid/java/test-profiles/test_resources/log4j.xml @@ -0,0 +1,53 @@ +<?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. + --><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="null" threshold="null"> + + + + <appender class="org.apache.log4j.FileAppender" name="TestAppender"> + <param name="File" value="${test.output.dir}${file.separator}TEST-${qpid.testClass}${qpid.testMethod}.txt"/> + <param name="Append" value="false"/> + + + <!-- TODO date not interesting for test debugging. log only the time to save width --> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d %-5p [%t] (%c{2}) - %m%n"/> + </layout> + </appender> + + + <!-- General logging hierarchy --> + <logger name="org.apache.qpid"> + <level value="${amqj.logging.level}"/> + </logger> + + <logger name="qpid.message"> + <level value="INFO"/> + </logger> + + + <!-- Log all info events to file --> + <root> + <level value="debug"/> + <appender-ref ref="TestAppender"/> + </root> + +</log4j:configuration> diff --git a/qpid/java/test-profiles/log4j-test.xml b/qpid/java/test-profiles/test_resources/spawned-broker-log4j.xml index a393fa0952..6bb91f88b1 100644 --- a/qpid/java/test-profiles/log4j-test.xml +++ b/qpid/java/test-profiles/test_resources/spawned-broker-log4j.xml @@ -48,18 +48,10 @@ <level value="${amqj.protocol.logging.level}"/> </logger> - <logger name="org.apache.qpid.test.utils.QpidTestCase"> - <level value="ALL"/> - </logger> - <logger name="org.apache.commons"> <level value="WARN"/> </logger> - <logger name="apache.commons.configuration.ConfigurationFactory"> - <level value="ERROR"/> - </logger> - <root> <level value="${root.logging.level}"/> <appender-ref ref="console" /> |
