logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1385339 - in /logging/log4j/log4j2/trunk: core/src/main/java/org/apache/logging/log4j/core/config/ core/src/test/java/org/apache/logging/log4j/core/config/ web/src/main/java/org/apache/logging/log4j/core/web/
Date Sun, 16 Sep 2012 18:42:02 GMT
Author: rgoers
Date: Sun Sep 16 18:42:02 2012
New Revision: 1385339

URL: http://svn.apache.org/viewvc?rev=1385339&view=rev
Log:
Fix the spelling of "initialize".

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
    logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java?rev=1385339&r1=1385338&r2=1385339&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
Sun Sep 16 18:42:02 2012
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.LogManag
 import org.apache.logging.log4j.core.LoggerContext;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 
 /**
  * Class that can be used to initialize and configure the Logging system.
@@ -36,12 +37,29 @@ public final class Configurator {
      * @param configLocation The configuration for the logging context.
      * @return The LoggerContext.
      */
-    public static LoggerContext intitalize(String name, ClassLoader loader, String configLocation)
{
+    public static LoggerContext initialize(String name, ClassLoader loader, String configLocation)
{
 
         try {
-            LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
             URI uri = configLocation == null ? null : new URI(configLocation);
-            Configuration config = ConfigurationFactory.getInstance().getConfiguration(name,
uri);
+            return initialize(name, loader, uri);
+        } catch (URISyntaxException ex) {
+            ex.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * Initialize the Logging Context.
+     * @param name The Context name.
+     * @param loader The ClassLoader for the Context (or null).
+     * @param configLocation The configuration for the logging context.
+     * @return The LoggerContext.
+     */
+    public static LoggerContext initialize(String name, ClassLoader loader, URI configLocation)
{
+
+        try {
+            LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
+            Configuration config = ConfigurationFactory.getInstance().getConfiguration(name,
configLocation);
             ctx.setConfiguration(config);
             return ctx;
         } catch (Exception ex) {

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1385339&r1=1385338&r2=1385339&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
Sun Sep 16 18:42:02 2012
@@ -41,7 +41,7 @@ public class TestConfigurator {
 
     @Test
     public void testFromFile() throws Exception {
-        LoggerContext ctx = Configurator.intitalize("Test1", null, "target/test-classes/log4j2-config.xml");
+        LoggerContext ctx = Configurator.initialize("Test1", null, "target/test-classes/log4j2-config.xml");
         Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
         Configuration config = ctx.getConfiguration();
         assertNotNull("No configuration", config);
@@ -58,7 +58,7 @@ public class TestConfigurator {
 
     @Test
     public void testFromClassPath() throws Exception {
-        LoggerContext ctx = Configurator.intitalize("Test1", null, "log4j2-config.xml");
+        LoggerContext ctx = Configurator.initialize("Test1", null, "log4j2-config.xml");
         Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
         Configuration config = ctx.getConfiguration();
         assertNotNull("No configuration", config);
@@ -75,7 +75,7 @@ public class TestConfigurator {
 
     @Test
     public void testByName() throws Exception {
-        LoggerContext ctx = Configurator.intitalize("-config", null, null);
+        LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
         Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
         Configuration config = ctx.getConfiguration();
         assertNotNull("No configuration", config);
@@ -94,7 +94,7 @@ public class TestConfigurator {
     public void testReconfiguration() throws Exception {
         File file = new File("target/test-classes/log4j2-config.xml");
         file.setLastModified(System.currentTimeMillis() - 120000);
-        LoggerContext ctx = Configurator.intitalize("Test1", null, "target/test-classes/log4j2-config.xml");
+        LoggerContext ctx = Configurator.initialize("Test1", null, "target/test-classes/log4j2-config.xml");
         Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
         Configuration config = ctx.getConfiguration();
         assertNotNull("No configuration", config);

Modified: logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java?rev=1385339&r1=1385338&r2=1385339&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
(original)
+++ logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
Sun Sep 16 18:42:02 2012
@@ -49,7 +49,7 @@ public class Log4jContextListener implem
             context.log("No Log4j context configuration provided");
             return;
         }
-        context.setAttribute(LOG4J_CONTEXT_ATTRIBUTE, Configurator.intitalize(name, getClassLoader(context),
locn));
+        context.setAttribute(LOG4J_CONTEXT_ATTRIBUTE, Configurator.initialize(name, getClassLoader(context),
locn));
     }
 
     public void contextDestroyed(ServletContextEvent event) {



Mime
View raw message