You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2005/01/03 12:05:46 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j Logger.java Category.java

ceki        2005/01/03 03:05:46

  Modified:    tests/src/java/org/apache/log4j/varia
                        LevelMatchFilterTestCase.java
                        LevelRangeFilterTestCase.java
               .        ugli.xml build.xml
               src/java/org/apache/ugli/impl JDK14Logger.java
                        SimpleLogger.java NOPLogger.java
               tests    build.xml
               src/java/org/apache/ugli ULogger.java
               src/java/org/apache/log4j Logger.java Category.java
  Added:       src/java/org/apache/ugli/impl Log4jLoggerFA.java
  Log:
  - o.a.log4j.Category now implements o.a.ugli.ULogger.
  - Since - o.a.log4j.Category implements o.a.ugli.ULogger, o.a.ugli.impl.Log4jLoggerFA consists of one or two lines of code.
  
  Revision  Changes    Path
  1.6       +2 -2      logging-log4j/tests/src/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java
  
  Index: LevelMatchFilterTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/varia/LevelMatchFilterTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LevelMatchFilterTestCase.java	27 Feb 2004 16:47:37 -0000	1.5
  +++ LevelMatchFilterTestCase.java	3 Jan 2005 11:05:45 -0000	1.6
  @@ -27,8 +27,8 @@
   import org.apache.log4j.Logger;
   import org.apache.log4j.SimpleLayout;
   import org.apache.log4j.util.Compare;
  -import org.apache.log4j.varia.DenyAllFilter;
  -import org.apache.log4j.varia.LevelMatchFilter;
  +import org.apache.log4j.filter.DenyAllFilter;
  +import org.apache.log4j.filter.LevelMatchFilter;
   
   
   /**
  
  
  
  1.4       +1 -1      logging-log4j/tests/src/java/org/apache/log4j/varia/LevelRangeFilterTestCase.java
  
  Index: LevelRangeFilterTestCase.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/log4j/varia/LevelRangeFilterTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LevelRangeFilterTestCase.java	27 Feb 2004 16:47:37 -0000	1.3
  +++ LevelRangeFilterTestCase.java	3 Jan 2005 11:05:45 -0000	1.4
  @@ -27,7 +27,7 @@
   import org.apache.log4j.Logger;
   import org.apache.log4j.SimpleLayout;
   import org.apache.log4j.util.Compare;
  -import org.apache.log4j.varia.LevelRangeFilter;
  +import org.apache.log4j.filter.LevelRangeFilter;
   
   
   /**
  
  
  
  1.4       +1 -3      logging-log4j/ugli.xml
  
  Index: ugli.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/ugli.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ugli.xml	3 Jan 2005 10:17:45 -0000	1.3
  +++ ugli.xml	3 Jan 2005 11:05:45 -0000	1.4
  @@ -1,4 +1,4 @@
  -<project name="ugli" default="ussage" basedir="." >
  +<project name="ugli" default="usage" basedir="." >
   
     <!-- The directory where source files are stored. -->
     <property name="java.source.dir" value="./src/java/"/>
  @@ -133,8 +133,6 @@
         <param name="jar-name" value="ugli-jdk14.jar"/>
       </antcall>
     </target>
  -
  -
   
   
   </project>
  
  
  
  1.128     +6 -2      logging-log4j/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/build.xml,v
  retrieving revision 1.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- build.xml	3 Jan 2005 10:17:45 -0000	1.127
  +++ build.xml	3 Jan 2005 11:05:45 -0000	1.128
  @@ -234,8 +234,12 @@
       <javac srcdir="${java.source.dir}"
        destdir="${javac.dest}"
        deprecation="on"
  -     includes="${stem}/**/*.java, org/apache/joran/**/*.java, ${stem}/xml/XMLLayout.java,"
  -     excludes="misc/*, **/UnitTest*.java,
  +     includes="org/apache/ugli/**/*.java,
  +    	       ${stem}/**/*.java, 
  +    	       org/apache/joran/**/*.java, 
  +    	       ${stem}/xml/XMLLayout.java,"
  +     excludes="org/apache/ugli/impl/JDK14*.java,
  +    	            **/UnitTest*.java,
                       **/StressCategory.java,
                       **/doc-files/*,
   			        ${stem}/chainsaw/**,
  
  
  
  1.4       +4 -4      logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java
  
  Index: JDK14Logger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/ugli/impl/JDK14Logger.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDK14Logger.java	31 Dec 2004 17:51:32 -0000	1.3
  +++ JDK14Logger.java	3 Jan 2005 11:05:45 -0000	1.4
  @@ -95,7 +95,7 @@
      * @param param1 - the first parameter
      * @param param2 - the second parameter
      */
  -  public void debug(Object parameterizedMsg, Object param1, Object param2) {
  +  public void debug(String parameterizedMsg, Object param1, Object param2) {
       if (logger.isLoggable(Level.FINE)) {
         if (parameterizedMsg instanceof String) {
           String msgStr = (String) parameterizedMsg;
  @@ -135,7 +135,7 @@
       }
     }
   
  -  public void info(Object parameterizedMsg, Object param1, Object param2) {
  +  public void info(String parameterizedMsg, Object param1, Object param2) {
       if (logger.isLoggable(Level.INFO)) {
         if (parameterizedMsg instanceof String) {
           String msgStr = (String) parameterizedMsg;
  @@ -175,7 +175,7 @@
       }
     }
   
  -  public void warn(Object parameterizedMsg, Object param1, Object param2) {
  +  public void warn(String parameterizedMsg, Object param1, Object param2) {
       if (logger.isLoggable(Level.WARNING)) {
         if (parameterizedMsg instanceof String) {
           String msgStr = (String) parameterizedMsg;
  @@ -215,7 +215,7 @@
       }
     }
     
  -  public void error(Object parameterizedMsg, Object param1, Object param2) {
  +  public void error(String parameterizedMsg, Object param1, Object param2) {
       if (logger.isLoggable(Level.WARNING)) {
         if (parameterizedMsg instanceof String) {
           String msgStr = (String) parameterizedMsg;
  
  
  
  1.3       +4 -4      logging-log4j/src/java/org/apache/ugli/impl/SimpleLogger.java
  
  Index: SimpleLogger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/ugli/impl/SimpleLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleLogger.java	31 Dec 2004 17:51:32 -0000	1.2
  +++ SimpleLogger.java	3 Jan 2005 11:05:45 -0000	1.3
  @@ -87,7 +87,7 @@
     /**
      * A NOP implementation.
      */
  -  public void debug(Object parameterizedMsg, Object param1, Object param2) {
  +  public void debug(String parameterizedMsg, Object param1, Object param2) {
       // NOP
     }
   
  @@ -181,7 +181,7 @@
      * INFO according to the format outlined above.
      */
     
  -  public void info(Object parameterizedMsg, Object param1, Object param2) {
  +  public void info(String parameterizedMsg, Object param1, Object param2) {
       parameterizedLog(INFO_STR, parameterizedMsg, param1, param2);
     }
   
  @@ -219,7 +219,7 @@
      * Perform double parameter substituion before logging the message of level 
      * WARN according to the format outlined above.
      */
  -  public void warn(Object parameterizedMsg, Object param1, Object param2) {
  +  public void warn(String parameterizedMsg, Object param1, Object param2) {
       parameterizedLog(WARN_STR, parameterizedMsg, param1, param2);
     }
   
  @@ -258,7 +258,7 @@
      * Perform double parameter substituion before logging the message of level 
      * ERROR according to the format outlined above.
      */
  -  public void error(Object parameterizedMsg, Object param1, Object param2) {
  +  public void error(String parameterizedMsg, Object param1, Object param2) {
       parameterizedLog(ERROR_STR, parameterizedMsg, param1, param2);
     }
   
  
  
  
  1.2       +4 -4      logging-log4j/src/java/org/apache/ugli/impl/NOPLogger.java
  
  Index: NOPLogger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/ugli/impl/NOPLogger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NOPLogger.java	30 Dec 2004 20:44:50 -0000	1.1
  +++ NOPLogger.java	3 Jan 2005 11:05:45 -0000	1.2
  @@ -62,7 +62,7 @@
     /* A NOP implementation.
      * @see org.apache.ugli.Logger#debug(java.lang.Object, java.lang.Object, java.lang.Object)
      */
  -  public void debug(Object parameterizedMsg, Object param1, Object param2) {
  +  public void debug(String parameterizedMsg, Object param1, Object param2) {
       // NOP
     }
   
  @@ -98,7 +98,7 @@
     /* A NOP implementation.
      * @see org.apache.ugli.Logger#info(java.lang.Object, java.lang.Object, java.lang.Object)
      */
  -  public void info(Object parameterizedMsg, Object param1, Object param2) {
  +  public void info(String parameterizedMsg, Object param1, Object param2) {
       // NOP
     }
   
  @@ -133,7 +133,7 @@
     /* A NOP implementation.
      * @see org.apache.ugli.Logger#warn(java.lang.Object, java.lang.Object, java.lang.Object)
      */
  -  public void warn(Object parameterizedMsg, Object param1, Object param2) {
  +  public void warn(String parameterizedMsg, Object param1, Object param2) {
       // NOP
     }
   
  @@ -168,7 +168,7 @@
     /* A NOP implementation.
      * @see org.apache.ugli.Logger#error(java.lang.Object, java.lang.Object, java.lang.Object)
      */
  -  public void error(Object parameterizedMsg, Object param1, Object param2) {
  +  public void error(String parameterizedMsg, Object param1, Object param2) {
       // NOP
     }
   
  
  
  
  1.1                  logging-log4j/src/java/org/apache/ugli/impl/Log4jLoggerFA.java
  
  Index: Log4jLoggerFA.java
  ===================================================================
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed 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.ugli.impl;
  
  import org.apache.log4j.LogManager;
  import org.apache.ugli.LoggerFactoryAdapter;
  import org.apache.ugli.ULogger;
  
  /**
   * @author ceki
   *
   * To change the template for this generated type comment go to
   * Window>Preferences>Java>Code Generation>Code and Comments
   */
  public class Log4jLoggerFA implements LoggerFactoryAdapter {
  
    public Log4jLoggerFA() {
    }
  
    /* (non-Javadoc)
     * @see org.apache.ugli.LoggerFactoryAdapter#getLogger(java.lang.String)
     */
    public ULogger getLogger(String name) {
      return LogManager.getLogger(name);  
    }
  
    /* (non-Javadoc)
     * @see org.apache.ugli.LoggerFactoryAdapter#getLogger(java.lang.String, java.lang.String)
     */
    public ULogger getLogger(String domainName, String subDomainName) {
      return LogManager.getLogger(domainName);  
    }
  }
  
  
  
  1.86      +1 -1      logging-log4j/tests/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.xml,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- build.xml	3 Jan 2005 10:17:45 -0000	1.85
  +++ build.xml	3 Jan 2005 11:05:45 -0000	1.86
  @@ -390,7 +390,7 @@
       <junit printsummary="yes" fork="yes" haltonfailure="yes">
         <classpath refid="tests.classpath"/>
         <formatter type="plain" usefile="false"/>
  -      <test name="org.apache.log4j.filters.LevelMatchFilterTestCase" />
  +      <test name="org.apache.log4j.filter.LevelMatchFilterTestCase" />
       </junit>
     </target>
     
  
  
  
  1.2       +4 -4      logging-log4j/src/java/org/apache/ugli/ULogger.java
  
  Index: ULogger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/ugli/ULogger.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ULogger.java	30 Dec 2004 20:44:50 -0000	1.1
  +++ ULogger.java	3 Jan 2005 11:05:45 -0000	1.2
  @@ -63,28 +63,28 @@
      * @param param1 - the first parameter 
      * @param param2 - the second parameter 
      */
  -  public void debug(Object parameterizedMsg, Object param1, Object param2);
  +  public void debug(String parameterizedMsg, Object param1, Object param2);
     public void debug(Object msg, Throwable t);
   
   
     public boolean isInfoEnabled();
     public void info(Object msg);
     public void info(Object parameterizedMsg, Object param1);
  -  public void info(Object parameterizedMsg, Object param1, Object param2);
  +  public void info(String parameterizedMsg, Object param1, Object param2);
     public void info(Object msg, Throwable t);
   
   
     public boolean isWarnEnabled();
     public void warn(Object msg);
     public void warn(Object parameterizedMsg, Object param1);
  -  public void warn(Object parameterizedMsg, Object param1, Object param2);
  +  public void warn(String parameterizedMsg, Object param1, Object param2);
     public void warn(Object msg, Throwable t);
   
   
     public boolean isErrorEnabled();
     public void error(Object msg);
     public void error(Object parameterizedMsg, Object param1);
  -  public void error(Object parameterizedMsg, Object param1, Object param2);
  +  public void error(String parameterizedMsg, Object param1, Object param2);
     public void error(Object msg, Throwable t);
   
   }
  
  
  
  1.28      +2 -96     logging-log4j/src/java/org/apache/log4j/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Logger.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Logger.java	31 Dec 2004 15:18:58 -0000	1.27
  +++ Logger.java	3 Jan 2005 11:05:45 -0000	1.28
  @@ -17,6 +17,7 @@
   package org.apache.log4j;
   
   import org.apache.log4j.spi.LoggerFactory;
  +import org.apache.ugli.ULogger;
   import org.apache.ugli.impl.MessageFormatter;
   
   
  @@ -28,7 +29,7 @@
    * @author Ceki G&uuml;lc&uuml;
    * @since log4j 1.2
   */
  -public class Logger extends Category {
  +public class Logger extends Category implements ULogger {
     /**
      * The fully qualified name of the Logger class. See also the {@link #getFQCN}
      * method.
  @@ -198,101 +199,6 @@
       if (Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel())) {
         messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
         forcedLog(FQCN, Level.TRACE, messagePattern, null);
  -    }
  -  }
  -
  -  /**
  -   * Log a message with the <code>DEBUG</code> level with message formatting
  -   * done according to the messagePattern and the arguments arg1 and arg2.
  -   * <p>
  -   * This form avoids superflous parameter construction. Whenever possible,
  -   * you should use this form instead of constructing the message parameter 
  -   * using string concatenation.
  -   * 
  -   * @param messagePattern The message pattern which will be parsed and formatted
  -   * @param arg1 The first argument to replace the first formatting element
  -   * @param arg2 The second argument to replace the second formatting element
  -   * @since 1.3
  -   */
  -  public void debug(String messagePattern, Object arg1, Object arg2) {
  -    if (repository.isDisabled(Level.DEBUG_INT)) {
  -      return;
  -    }
  -    if (Level.DEBUG.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  -      forcedLog(FQCN, Level.DEBUG, messagePattern, null);
  -    }
  -  }
  -  
  -  /**
  -   * Log a message with the <code>INFO</code> level with message formatting
  -   * done according to the messagePattern and the arguments arg1 and arg2.
  -   * <p>
  -   * This form avoids superflous parameter construction. Whenever possible,
  -   * you should use this form instead of constructing the message parameter 
  -   * using string concatenation.
  -   *
  -   * @param messagePattern The message pattern which will be parsed and formatted
  -   * @param arg1 The first argument to replace the first formatting element
  -   * @param arg2 The second argument to replace the second formatting element
  -   * @since 1.3
  -   */
  -  public void info(String messagePattern, Object arg1, Object arg2) {
  -    if (repository.isDisabled(Level.INFO_INT)) {
  -      return;
  -    }
  -    if (Level.INFO.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  -      forcedLog(FQCN, Level.INFO, messagePattern, null);
  -    }
  -  }
  -  
  -  
  -  /**
  -   * Log a message with the <code>WARN</code> level with message formatting
  -   * done according to the messagePattern and the arguments arg1 and arg2.
  -   * <p>
  -   * This form avoids superflous parameter construction. Whenever possible,
  -   * you should use this form instead of constructing the message parameter 
  -   * using string concatenation.
  -   *
  -   * @param messagePattern The message pattern which will be parsed and formatted
  -   * @param arg1 The first argument to replace the first formatting element
  -   * @param arg2 The second argument to replace the second formatting element
  -   * @since 1.3
  -   */
  -  public void warn(String messagePattern, Object arg1, Object arg2) {
  -    if (repository.isDisabled(Level.WARN_INT)) {
  -      return;
  -    }
  -    if (Level.WARN.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  -      forcedLog(FQCN, Level.WARN, messagePattern, null);
  -    }
  -  }
  -  
  -
  -  
  -  /**
  -   * Log a message with the <code>ERROR</code> level with message formatting
  -   * done according to the messagePattern and the arguments arg1 and arg2.
  -   * <p>
  -   * This form avoids superflous parameter construction. Whenever possible,
  -   * you should use this form instead of constructing the message parameter 
  -   * using string concatenation.
  -   *
  -   * @param messagePattern The message pattern which will be parsed and formatted
  -   * @param arg1 The first argument to replace the first formatting element
  -   * @param arg2 The second argument to replace the second formatting element
  -   * @since 1.3
  -   */
  -  public void error(String messagePattern, Object arg1, Object arg2) {
  -    if (repository.isDisabled(Level.ERROR_INT)) {
  -      return;
  -    }
  -    if (Level.ERROR.isGreaterOrEqual(this.getEffectiveLevel())) {
  -      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  -      forcedLog(FQCN, Level.ERROR, messagePattern, null);
       }
     }
     
  
  
  
  1.95      +125 -1    logging-log4j/src/java/org/apache/log4j/Category.java
  
  Index: Category.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/Category.java,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- Category.java	31 Dec 2004 15:18:58 -0000	1.94
  +++ Category.java	3 Jan 2005 11:05:45 -0000	1.95
  @@ -37,6 +37,7 @@
   import org.apache.log4j.spi.AppenderAttachable;
   import org.apache.log4j.spi.LoggerRepository;
   import org.apache.log4j.spi.LoggingEvent;
  +import org.apache.ugli.ULogger;
   import org.apache.ugli.impl.MessageFormatter;
   
   import java.util.Enumeration;
  @@ -88,7 +89,7 @@
    * @author Anders Kristensen
    * @author Yoav Shapira
    */
  -public class Category implements AppenderAttachable {
  +public class Category implements ULogger, AppenderAttachable {
     /**
      * The fully qualified name of the Category class. See also the getFQCN
      * method.
  @@ -337,6 +338,43 @@
       }
     }
     
  +  /**
  +   * Log a message with the <code>DEBUG</code> level with message formatting
  +   * done according to the messagePattern and the arguments arg1 and arg2.
  +   * <p>
  +   * This form avoids superflous parameter construction. Whenever possible,
  +   * you should use this form instead of constructing the message parameter 
  +   * using string concatenation.
  +   * 
  +   * @param messagePattern The message pattern which will be parsed and formatted
  +   * @param arg1 The first argument to replace the first formatting element
  +   * @param arg2 The second argument to replace the second formatting element
  +   * @since 1.3
  +   */
  +  public void debug(String messagePattern, Object arg1, Object arg2) {
  +    if (repository.isDisabled(Level.DEBUG_INT)) {
  +      return;
  +    }
  +    if (Level.DEBUG.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  +      forcedLog(FQCN, Level.DEBUG, messagePattern, null);
  +    }
  +  }
  +  
  +  /**
  +   * Check whether this category is enabled for the ERROR Level. See also
  +   * {@link #isDebugEnabled()}.
  +   *
  +   * @return boolean - <code>true</code> if this category is enabled for level
  +   *         ERROR, <code>false</code> otherwise.
  +   */
  +  public boolean isErrorEnabled() {
  +    if (repository.isDisabled(Level.ERROR_INT)) {
  +      return false;
  +    }
  +
  +    return Level.ERROR.isGreaterOrEqual(this.getEffectiveLevel());
  +  }
   
     /**
      * Log a message object with the {@link Level#ERROR ERROR} Level.
  @@ -424,6 +462,29 @@
     }
     
     /**
  +   * Log a message with the <code>ERROR</code> level with message formatting
  +   * done according to the messagePattern and the arguments arg1 and arg2.
  +   * <p>
  +   * This form avoids superflous parameter construction. Whenever possible,
  +   * you should use this form instead of constructing the message parameter 
  +   * using string concatenation.
  +   *
  +   * @param messagePattern The message pattern which will be parsed and formatted
  +   * @param arg1 The first argument to replace the first formatting element
  +   * @param arg2 The second argument to replace the second formatting element
  +   * @since 1.3
  +   */
  +  public void error(String messagePattern, Object arg1, Object arg2) {
  +    if (repository.isDisabled(Level.ERROR_INT)) {
  +      return;
  +    }
  +    if (Level.ERROR.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  +      forcedLog(FQCN, Level.ERROR, messagePattern, null);
  +    }
  +  }
  +  
  +  /**
      * If the named category exists (in the default hierarchy) then it returns a
      * reference to the category, otherwise it returns <code>null</code>.
      *
  @@ -830,6 +891,30 @@
     }
     
     /**
  +   * Log a message with the <code>INFO</code> level with message formatting
  +   * done according to the messagePattern and the arguments arg1 and arg2.
  +   * <p>
  +   * This form avoids superflous parameter construction. Whenever possible,
  +   * you should use this form instead of constructing the message parameter 
  +   * using string concatenation.
  +   *
  +   * @param messagePattern The message pattern which will be parsed and formatted
  +   * @param arg1 The first argument to replace the first formatting element
  +   * @param arg2 The second argument to replace the second formatting element
  +   * @since 1.3
  +   */
  +  public void info(String messagePattern, Object arg1, Object arg2) {
  +    if (repository.isDisabled(Level.INFO_INT)) {
  +      return;
  +    }
  +    if (Level.INFO.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  +      forcedLog(FQCN, Level.INFO, messagePattern, null);
  +    }
  +  }
  +  
  +  
  +  /**
      * Log a message object with the <code>INFO</code> level including the stack
      * trace of the {@link Throwable}<code>t</code> passed as parameter.
      *
  @@ -1232,6 +1317,23 @@
       LogManager.shutdown();
     }
   
  +  
  +  /**
  +   * Check whether this category is enabled for the WARN Level. See also
  +   * {@link #isDebugEnabled()}.
  +   *
  +   * @return boolean - <code>true</code> if this category is enabled for level
  +   *         WARN, <code>false</code> otherwise.
  +   */
  +  public boolean isWarnEnabled() {
  +    if (repository.isDisabled(Level.WARN_INT)) {
  +      return false;
  +    }
  +
  +    return Level.WARN.isGreaterOrEqual(this.getEffectiveLevel());
  +  }
  +
  +  
     /**
      * Log a message object with the {@link Level#WARN WARN} Level.
      *
  @@ -1315,6 +1417,28 @@
           // a String. Unless the user makes a mistake, this should never happen.
           forcedLog(FQCN, Level.WARN, messagePattern, null);
         }
  +    }
  +  }
  +  /**
  +   * Log a message with the <code>WARN</code> level with message formatting
  +   * done according to the messagePattern and the arguments arg1 and arg2.
  +   * <p>
  +   * This form avoids superflous parameter construction. Whenever possible,
  +   * you should use this form instead of constructing the message parameter 
  +   * using string concatenation.
  +   *
  +   * @param messagePattern The message pattern which will be parsed and formatted
  +   * @param arg1 The first argument to replace the first formatting element
  +   * @param arg2 The second argument to replace the second formatting element
  +   * @since 1.3
  +   */
  +  public void warn(String messagePattern, Object arg1, Object arg2) {
  +    if (repository.isDisabled(Level.WARN_INT)) {
  +      return;
  +    }
  +    if (Level.WARN.isGreaterOrEqual(this.getEffectiveLevel())) {
  +      messagePattern = MessageFormatter.format(messagePattern, arg1, arg2);
  +      forcedLog(FQCN, Level.WARN, messagePattern, null);
       }
     }
   }
  
  
  

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