logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1437815 - in /logging/log4j/log4j2/trunk/flume-ng: ./ src/main/java/org/apache/logging/log4j/flume/appender/ src/test/java/org/apache/logging/log4j/flume/appender/ src/test/resources/
Date Thu, 24 Jan 2013 01:02:52 GMT
Author: rgoers
Date: Thu Jan 24 01:02:51 2013
New Revision: 1437815

URL: http://svn.apache.org/viewvc?rev=1437815&view=rev
Log:
Revert to Flume 1.2.0. Improve use of Flume Lifecycle

Modified:
    logging/log4j/log4j2/trunk/flume-ng/pom.xml
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java
    logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
    logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml

Modified: logging/log4j/log4j2/trunk/flume-ng/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/pom.xml?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/pom.xml (original)
+++ logging/log4j/log4j2/trunk/flume-ng/pom.xml Thu Jan 24 01:02:51 2013
@@ -32,7 +32,7 @@
     <log4jParentDir>${basedir}/..</log4jParentDir>
     <docLabel>Flume Documentation</docLabel>
     <projectDir>/flume-ng</projectDir>
-    <flumeVersion>1.3.1</flumeVersion>
+    <flumeVersion>1.2.0</flumeVersion>
   </properties>
   <dependencies>
     <dependency>

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeConfigurationBuilder.java
Thu Jan 24 01:02:51 2013
@@ -111,7 +111,7 @@ public class FlumeConfigurationBuilder {
             loadSources(agentConf, conf);
             loadSinks(agentConf, conf);
 
-            configurationAware.startAllComponents(conf);
+            //configurationAware.startAllComponents(conf);
         } else {
             LOGGER.warn("No configuration found for: {}", name);
         }

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
Thu Jan 24 01:02:51 2013
@@ -17,14 +17,11 @@
 package org.apache.logging.log4j.flume.appender;
 
 import org.apache.flume.SourceRunner;
-import org.apache.flume.lifecycle.LifecycleController;
-import org.apache.flume.lifecycle.LifecycleState;
 import org.apache.flume.node.NodeConfiguration;
 import org.apache.flume.node.nodemanager.DefaultLogicalNodeManager;
 import org.apache.logging.log4j.core.appender.ManagerFactory;
 import org.apache.logging.log4j.core.config.ConfigurationException;
 import org.apache.logging.log4j.core.config.Property;
-import org.apache.logging.log4j.core.helpers.Constants;
 import org.apache.logging.log4j.core.helpers.NameUtil;
 import org.apache.logging.log4j.util.PropertiesUtil;
 
@@ -176,10 +173,9 @@ public class FlumeEmbeddedManager extend
                 final FlumeConfigurationBuilder builder = new FlumeConfigurationBuilder();
                 final NodeConfiguration conf = builder.load(data.name, props, nodeManager);
 
-                final FlumeNode node = new FlumeNode(nodeManager, conf);
+                final FlumeNode node = new FlumeNode(nodeManager, nodeManager, conf);
 
                 node.start();
-                LifecycleController.waitForOneOf(node, LifecycleState.START_OR_ERROR);
 
                 return new FlumeEmbeddedManager(name, data.name, node);
             } catch (final Exception ex) {

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeNode.java
Thu Jan 24 01:02:51 2013
@@ -19,9 +19,9 @@ package org.apache.logging.log4j.flume.a
 import com.google.common.base.Preconditions;
 import org.apache.flume.lifecycle.LifecycleAware;
 import org.apache.flume.lifecycle.LifecycleState;
-import org.apache.flume.lifecycle.LifecycleSupervisor;
 import org.apache.flume.node.NodeConfiguration;
 import org.apache.flume.node.NodeManager;
+import org.apache.flume.node.nodemanager.NodeConfigurationAware;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -34,25 +34,23 @@ public class FlumeNode implements Lifecy
 
     private LifecycleState lifecycleState;
     private final NodeManager nodeManager;
-    private final LifecycleSupervisor supervisor;
+    private final NodeConfigurationAware configurationAware;
     private final NodeConfiguration conf;
 
-    public FlumeNode(final NodeManager manager, final NodeConfiguration conf) {
+    public FlumeNode(final NodeConfigurationAware configurationAware, final NodeManager manager,
+                     final NodeConfiguration conf) {
         this.nodeManager = manager;
         this.conf = conf;
-        supervisor = new LifecycleSupervisor();
+        this.configurationAware = configurationAware;
     }
 
     public void start() {
 
         Preconditions.checkState(nodeManager != null, "Node manager can not be null");
 
-        supervisor.start();
-
         LOGGER.info("Flume node starting");
 
-        supervisor.supervise(nodeManager,
-            new LifecycleSupervisor.SupervisorPolicy.AlwaysRestartPolicy(), LifecycleState.START);
+        configurationAware.startAllComponents(conf);
 
         lifecycleState = LifecycleState.START;
     }
@@ -61,7 +59,7 @@ public class FlumeNode implements Lifecy
 
         LOGGER.info("Flume node stopping");
 
-        supervisor.stop();
+        configurationAware.stopAllComponents();
 
         lifecycleState = LifecycleState.STOP;
     }
@@ -77,5 +75,4 @@ public class FlumeNode implements Lifecy
     public LifecycleState getLifecycleState() {
         return lifecycleState;
     }
-
 }

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedAgentTest.java
Thu Jan 24 01:02:51 2013
@@ -148,12 +148,18 @@ public class FlumeEmbeddedAgentTest {
     public void teardown() throws Exception {
         System.clearProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
         ctx.reconfigure();
-        primarySource.stop();
-        altSource.stop();
-        Assert.assertTrue("Reached stop or error",
-            LifecycleController.waitForOneOf(primarySource, LifecycleState.STOP_OR_ERROR));
-        Assert.assertEquals("Server is stopped", LifecycleState.STOP,
-            primarySource.getLifecycleState());
+        if (primarySource != null && primarySource.getLifecycleState() != null &&
+                !primarySource.getLifecycleState().equals(LifecycleState.STOP)) {
+            primarySource.stop();
+        }
+        if (altSource != null && altSource.getLifecycleState() != null &&
+                !altSource.getLifecycleState().equals(LifecycleState.STOP)) {
+            altSource.stop();
+            Assert.assertTrue("Reached stop or error",
+                    LifecycleController.waitForOneOf(primarySource, LifecycleState.STOP_OR_ERROR));
+            Assert.assertEquals("Server is stopped", LifecycleState.STOP,
+                    primarySource.getLifecycleState());
+        }
         final File file = new File("target/file-channel");
         final boolean result = deleteFiles(file);
         final MBeanServer server = ManagementFactory.getPlatformMBeanServer();

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml?rev=1437815&r1=1437814&r2=1437815&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml Thu Jan 24
01:02:51 2013
@@ -7,14 +7,14 @@
       <RFC5424Layout enterpriseNumber="18060" includeMDC="true" appName="MyApp"/>
     </Flume>
     <Console name="STDOUT">
-      <PatternLayout pattern="%d [%p] %c %m%n"/>
+      <PatternLayout pattern="%d %t - [%p] %c %m%n"/>
     </Console>
   </appenders>
   <loggers>
     <logger name="EventLogger" level="info">
       <appender-ref ref="eventLogger"/>
     </logger>
-    <root level="warn">
+    <root level="error">
       <appender-ref ref="STDOUT"/>
     </root>
   </loggers>



Mime
View raw message