logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r946745 [3/3] - in /logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers: log4j12-api/ log4j12-api/src/main/java/org/apache/log4j/ log4j12-api/src/main/java/org/apache/logging/ log4j12-api/src/test/java/org/ log4j12-api/src/test/java/org/a...
Date Thu, 20 May 2010 18:27:55 GMT
Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/config/XMLConfigurationFactory.java
Thu May 20 18:27:54 2010
@@ -28,7 +28,7 @@ import java.net.URL;
  *
  */
 @Plugin(name="XMLConfigurationFactory", type="ConfigurationFactory")
-@Order(1)
+@Order(5)
 public class XMLConfigurationFactory extends ConfigurationFactory {
 
     public static final String CONFIGURATION_FILE_PROPERTY = "log4j.configurationFile";

Added: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java?rev=946745&view=auto
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
(added)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/helpers/NameUtil.java
Thu May 20 18:27:54 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.apache.logging.log4j.core.helpers;
+
+/**
+ *
+ */
+public final class NameUtil {
+
+    private NameUtil() {
+    }
+
+    public static String getSubName(String name) {
+        if (name.length() == 0) {
+            return null;
+        }
+        int i = name.lastIndexOf(".");
+        return i > 0 ? name.substring(0, i) : "";
+    }
+}

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/LogEventPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/LogEventPatternConverter.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/LogEventPatternConverter.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/LogEventPatternConverter.java
Thu May 20 18:27:54 2010
@@ -34,8 +34,7 @@ public abstract class LogEventPatternCon
      * @param name  name of converter.
      * @param style CSS style for output.
      */
-    protected LogEventPatternConverter(
-        final String name, final String style) {
+    protected LogEventPatternConverter(final String name, final String style) {
         super(name, style);
     }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MDCPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MDCPatternConverter.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MDCPatternConverter.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MDCPatternConverter.java
Thu May 20 18:27:54 2010
@@ -57,8 +57,7 @@ public final class MDCPatternConverter e
      * @param options options, may be null or first element contains name of property to
format.
      * @return instance of PropertiesPatternConverter.
      */
-    public static MDCPatternConverter newInstance(
-        final String[] options) {
+    public static MDCPatternConverter newInstance(final String[] options) {
         return new MDCPatternConverter(options);
     }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MessagePatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MessagePatternConverter.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MessagePatternConverter.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/MessagePatternConverter.java
Thu May 20 18:27:54 2010
@@ -19,6 +19,10 @@ package org.apache.logging.log4j.core.la
 
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.MessageHint;
+
+import java.util.Map;
 
 
 /**
@@ -27,17 +31,16 @@ import org.apache.logging.log4j.core.con
 @Plugin(name="MessagePatternConverter", type="Converter")
 @ConverterKeys({"m", "message"})
 public final class MessagePatternConverter extends LogEventPatternConverter {
-    /**
-     * Singleton.
-     */
-    private static final MessagePatternConverter INSTANCE =
-        new MessagePatternConverter();
+
+    private final String format;
 
     /**
      * Private constructor.
+     * @param options options, may be null.
      */
-    private MessagePatternConverter() {
+    private MessagePatternConverter(final String[] options) {
         super("Message", "message");
+        format = (options != null && options.length > 0) ? options[0] : null;
     }
 
     /**
@@ -46,15 +49,19 @@ public final class MessagePatternConvert
      * @param options options, may be null.
      * @return instance of pattern converter.
      */
-    public static MessagePatternConverter newInstance(
-        final String[] options) {
-        return INSTANCE;
+    public static MessagePatternConverter newInstance(final String[] options) {
+        return new MessagePatternConverter(options);
     }
 
     /**
      * {@inheritDoc}
      */
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        toAppendTo.append(event.getMessage().getFormattedMessage());
+        Message msg = event.getMessage();
+        Map<MessageHint, String> hints = msg.getHints();
+        if (hints != null && hints.containsKey(MessageHint.FORMAT)) {
+            hints.put(MessageHint.FORMAT, format);
+        }
+        toAppendTo.append(msg.getFormattedMessage());
     }
 }

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/NDCPatternConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/NDCPatternConverter.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/NDCPatternConverter.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/layout/pattern/NDCPatternConverter.java
Thu May 20 18:27:54 2010
@@ -45,8 +45,7 @@ public final class NDCPatternConverter e
    * @param options options, may be null.
    * @return instance of NDCPatternConverter.
    */
-  public static NDCPatternConverter newInstance(
-    final String[] options) {
+  public static NDCPatternConverter newInstance(final String[] options) {
     return INSTANCE;
   }
 

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/BasicConfigurationFactory.java
Thu May 20 18:27:54 2010
@@ -35,7 +35,7 @@ public class BasicConfigurationFactory e
 
     private static final String DEFAULT_LEVEL = "org.apache.logging.log4j.level";
 
-     public BasicConfiguration() {
+    public BasicConfiguration() {
 
         LoggerConfig root = getRootLogger();
         String l = System.getProperty(DEFAULT_LEVEL);

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
Thu May 20 18:27:54 2010
@@ -71,7 +71,7 @@ public class XMLConfigurationTest {
         Logger logger = LogManager.getLogger("org.apache.logging.log4j.test1.Test");
         assertTrue(logger instanceof org.apache.logging.log4j.core.Logger);
         org.apache.logging.log4j.core.Logger l = (org.apache.logging.log4j.core.Logger) logger;
-        assertTrue(l.getLevel().equals(Level.DEBUG));
+        assertEquals(Level.DEBUG, l.getLevel());
         List<Filter> filters = l.getFilters();
         assertTrue("number of filters - " + filters.size(), filters.size() == 1);
         Filter filter = filters.get(0);

Modified: logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/pattern/PatternParserTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/pattern/PatternParserTest.java?rev=946745&r1=946744&r2=946745&view=diff
==============================================================================
--- logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/pattern/PatternParserTest.java
(original)
+++ logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/test/java/org/apache/logging/log4j/core/layout/pattern/PatternParserTest.java
Thu May 20 18:27:54 2010
@@ -16,15 +16,9 @@
  */
 package org.apache.logging.log4j.core.layout.pattern;
 
-import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.MDC;
-import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.appender.FileAppender;
-import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.Logger;
-import org.apache.logging.log4j.core.util.Compare;
 
 import org.junit.Before;
 import org.junit.Test;



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message