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/04/28 17:59:09 UTC

cvs commit: logging-log4j/src/java/org/slf4j ULogger.java LoggerFactory.java LoggerFactoryAdapter.java

ceki        2005/04/28 08:59:09

  Added:       src/filtered-java/org/slf4j LoggerFactoryAdapter.java
                        ULogger.java package.html LoggerFactory.java
                        .cvsignore
               src/filtered-java/org/slf4j/impl SimpleLogger.java
                        .cvsignore NOPLogger.java NOPLoggerFA.java
                        SimpleLoggerFA.java MessageFormatter.java
                        JDK14LoggerFA.java JDK14Logger.java
               src/java/org/slf4j/impl SimpleLoggerFA.java NOPLogger.java
                        MessageFormatter.java NOPLoggerFA.java
                        SimpleLogger.java
               src/java/org/slf4j ULogger.java LoggerFactory.java
                        LoggerFactoryAdapter.java
  Log:
  SLF4J migration
  
  Revision  Changes    Path
  1.1                  logging-log4j/src/filtered-java/org/slf4j/LoggerFactoryAdapter.java
  
  Index: LoggerFactoryAdapter.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * 
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  /**
   * LoggerFactoryAdapter interface is used internally by {@link
   * LoggerFactory}.
   * 
   * <p>Only developers wishing to write new UGLI adapters need to worry
   * about this interface.
   * 
   * @author Ceki G&uuml;lc&uuml;
   *
   */
  public interface LoggerFactoryAdapter {
    
    /**
     * Return the appropriate named {@link ULogger} instance.
     */
    public ULogger getLogger(String name);
    
    /**
     * Return a {@link ULogger} instance in <code>domain</code>, <code>subDomain</code>. 
     *
     * @param domain
     * @param subDomain
     * @return ULogger instance
     */
    public ULogger getLogger(String domain, String subDomain);  
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/ULogger.java
  
  Index: ULogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * 
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  /**
   * 
   * The main user inteface to logging. It is expected that logging
   * takes places through concerete implemetations of the ULogger
   * interface.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public interface ULogger {
  
    /**
     * Is the logger instance enabled for the DEBUG level?
     * @return True if this ULogger is enabled for the DEBUG level,
     * false otherwise.
     */
    public boolean isDebugEnabled();
    
    /**
     * Log a message object with the DEBUG level. 
     * @param msg - the message object to be logged
     */
    public void debug(Object msg);
    
    
    /**
     * Log a parameterized message object at the DEBUG level. 
     * 
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the parameter 
     */
    public void debug(Object parameterizedMsg, Object param1);
    
    /**
     * Log a parameterized message object at the DEBUG level. 
     * 
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the first parameter 
     * @param param2 - the second parameter 
     */
    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(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(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(String parameterizedMsg, Object param1, Object param2);
    public void error(Object msg, Throwable t);
  
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/package.html
  
  Index: package.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  
  
  <html> 
    <head>
      <title></title>
    </head>
  
  
    <body>
      
      <p>Core logging interfaces.</p>
      
      <hr/>
    </body> 
  </html>
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/LoggerFactory.java
  
  Index: LoggerFactory.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  // WARNING
  // WARNING Modifications MUST be made to the original file found at
  // WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/LoggerFactory.java
  // WARNING
  
  /**
   * The <code>LoggerFactory</code> can produce Loggers for various logging APIs,
   * most notably for log4j, JDK 1.4 logging. Other implemenations such as
   * {@link org.slf4j.impl.NOPLogger NOPLogger} and
   * {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
   *
   * @author Ceki G&uuml;lc&uuml;
   */
  public class LoggerFactory {
    static LoggerFactoryAdapter adapter;
  
    // 
    // WARNING Modify the original in
    //         $SLF4J_HOME/src/filtered-java/org/slf4j/
    
    static {
      String adapterClassStr = "org.slf4j.impl.@IMPL@LoggerFA";
      System.out.println("SLF4J built for "+adapterClassStr);
      try {
        adapter = new org.slf4j.impl.@IMPL@LoggerFA();
      } catch (Exception e) {
        // unless there was a problem with the build or the JVM we will never
        // get exceptions
        System.err.println(
          "Could not instantiate instance of class [" + adapterClassStr + "]");
        e.printStackTrace();
      }
    }
  
    public static ULogger getLogger(String name) {
      return adapter.getLogger(name);
    }
  
    public static ULogger getLogger(String domainName, String subDomainName) {
      return adapter.getLogger(domainName, subDomainName);
    }
  
    public static ULogger getLogger(Class clazz) {
      return adapter.getLogger(clazz.getName());
    }
  
    public static ULogger getLogger(Class clazz, String subDomainName) {
      return adapter.getLogger(clazz.getName(), subDomainName);
    }
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  .svn
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/SimpleLogger.java
  
  Index: SimpleLogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.ULogger;
  
  
  /**
   * A simple implementation that logs messages of level INFO or higher on
   * the console (<code>System.out<code>). 
   * <p>
   * The output includes the relative time in milliseconds, thread name, the level,  
   * logger name, and the message followed by the line separator for the host. 
   * In log4j terms it amounts to the "%r  [%t] %level %logger - %m%n" pattern.
   * <pre>
  176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
  225 [main] INFO examples.SortAlgo - Entered the sort method.
  304 [main] INFO SortAlgo.DUMP - Dump of interger array:
  317 [main] INFO SortAlgo.DUMP - Element [0] = 0
  331 [main] INFO SortAlgo.DUMP - Element [1] = 1
  343 [main] INFO examples.Sort - The next log statement should be an error message.
  346 [main] ERROR SortAlgo.DUMP - Tried to dump an uninitialized array.
          at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
          at org.log4j.examples.Sort.main(Sort.java:64)
  467 [main] INFO  examples.Sort - Exiting main method.
  </pre>
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class SimpleLogger implements ULogger {
  
    String loggerName;
    
    /**
     * Mark the time when this class gets loaded into memory.
     */
    static private long startTime = System.currentTimeMillis();
    
    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
    
    static private String INFO_STR = "INFO";
    static private String WARN_STR = "WARN";
    static private String ERROR_STR = "ERROR";
    
    /**
     * Package access allows only {@link SimpleLoggerFA} to instantiate 
     * SimpleLogger instances.
     */
    SimpleLogger(String name) {
      this.loggerName = name;
    }
    
    /**
     * Always returns false.
     */
    public boolean isDebugEnabled() {
      return false;
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object msg) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object msg, Throwable t) {
      // NOP
    }
  
    /**
     * This is our internal implementation for logging regular (non-parameterized)
     * log messages.
     * 
     * @param level
     * @param message
     * @param t
     */
    private void log(String level, String message, Throwable t) {
      StringBuffer buf = new StringBuffer();
      
      long millis  = System.currentTimeMillis();
      buf.append(millis-startTime);
      
      buf.append(" [");
      buf.append(Thread.currentThread().getName());
      buf.append("] ");
      
      buf.append(level);
      buf.append(" ");
      
      buf.append(loggerName);
      buf.append(" - ");
  
      buf.append(message);
  
      buf.append(LINE_SEPARATOR);
      
      System.out.print(buf.toString());
      if(t != null) {
        t.printStackTrace(System.out);
      }
      System.out.flush();
    }
    /**
     * For parameterized messages, first substitute parameters and then log.
     * 
     * @param level
     * @param parameterizedMsg
     * @param param1
     * @param param2
     */
    private void parameterizedLog(String level, Object parameterizedMsg, Object param1, Object param2) {
      if (parameterizedMsg instanceof String) {
        String msgStr = (String) parameterizedMsg;
        msgStr = MessageFormatter.format(msgStr, param1, param2);
        log(level, msgStr, null);
      } else {
        // To be failsafe, we handle the case where 'messagePattern' is not
        // a String. Unless the user makes a mistake, this should not happen.
        log(level, parameterizedMsg.toString(), null);
      }
    }
    
    /**
     * Always returns true.
     */
    public boolean isInfoEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level INFO according
     * to the format outlined above.
     */
    public void info(Object msg) {
      log(INFO_STR, msg.toString(), null);
    }
  
    
    /**
     * Perform single parameter substituion before logging the message of level 
     * INFO according to the format outlined above.
     */
    public void info(Object parameterizedMsg, Object param1) {
      parameterizedLog(INFO_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * INFO according to the format outlined above.
     */
    
    public void info(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(INFO_STR, parameterizedMsg, param1, param2);
    }
  
    /** 
     * Log a message of level INFO, including an exception.
     */
    public void info(Object msg, Throwable t) {
      log(INFO_STR, msg.toString(), t);
    }
  
    /**
     * Always returns true.
     */
    public boolean isWarnEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level WARN according
     * to the format outlined above.
    */
    public void warn(Object msg) {
      log(WARN_STR, msg.toString(), null);
    }
  
    /**
     * Perform single parameter substituion before logging the message of level 
     * WARN according to the format outlined above.
     */
    public void warn(Object parameterizedMsg, Object param1) {
      parameterizedLog(WARN_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * WARN according to the format outlined above.
     */
    public void warn(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(WARN_STR, parameterizedMsg, param1, param2);
    }
  
    /**
     * Log a message of level WARN, including an exception.
     */
    public void warn(Object msg, Throwable t) {
      log(WARN_STR, msg.toString(), t);
    }
  
    /**
     * Always returns true.
     */
    public boolean isErrorEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level ERROR acoording
     * to the format outlined above.
     */
    public void error(Object msg) {
      log(ERROR_STR, msg.toString(), null);
    }
  
  
    /**
     * Perform single parameter substituion before logging the message of level 
     * ERROR according to the format outlined above.
     */
    public void error(Object parameterizedMsg, Object param1) {
      parameterizedLog(ERROR_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * ERROR according to the format outlined above.
     */
    public void error(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(ERROR_STR, parameterizedMsg, param1, param2);
    }
  
    /** 
     * Log a message of level ERROR, including an exception.
     */
    public void error(Object msg, Throwable t) {
      log(ERROR_STR, msg.toString(), t);
    }
  
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  .svn
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/NOPLogger.java
  
  Index: NOPLogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.ULogger;
  
  
  /**
   * A no operation (NOP) implementation of {@link ULogger}.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class NOPLogger implements ULogger {
  
    /**
     * The unique instance of NOPLogger.
     */
    public final static NOPLogger NOP_LOGGER = new NOPLogger();
    
    /**
     * There is no point in people creating multiple instances of NullLogger. 
     * Hence, the private access modifier. 
     */
    private NOPLogger() {
    }
    
    /* Always returns false.
     * 
     * @see org.slf4j.Logger#isDebugEnabled()
     */
    public boolean isDebugEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object)
     */
    public void debug(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Object)
     */
    public void debug(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void debug(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Throwable)
     */
    public void debug(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isInfoEnabled()
     */
    public boolean isInfoEnabled() {
      // NOP
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object)
     */
    public void info(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object)
     */
    public void info(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void info(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Throwable)
     */
    public void info(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isWarnEnabled()
     */
    public boolean isWarnEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object)
     */
    public void warn(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object)
     */
    public void warn(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void warn(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Throwable)
     */
    public void warn(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isErrorEnabled()
     */
    public boolean isErrorEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object)
     */
    public void error(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Object)
     */
    public void error(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void error(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Throwable)
     */
    public void error(Object msg, Throwable t) {
      // NOP
    }
  
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/NOPLoggerFA.java
  
  Index: NOPLoggerFA.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.LoggerFactoryAdapter;
  import org.slf4j.ULogger;
  
  
  /**
   * NOPLoggerFA is am implementation of {@link LoggerFactoryAdapter}
   * which always returns the unique instance of NOPLogger.
   * 
   * @author Ceki Gulcu
   */
  public class NOPLoggerFA implements LoggerFactoryAdapter {
    
    public NOPLoggerFA() {
      // nothing to do
    }
    
    public ULogger getLogger(String name) {
      return NOPLogger.NOP_LOGGER;
    }
    public ULogger getLogger(String domainName, String subDomainName) {
      return NOPLogger.NOP_LOGGER;  
    }  
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/SimpleLoggerFA.java
  
  Index: SimpleLoggerFA.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import org.slf4j.LoggerFactoryAdapter;
  import org.slf4j.ULogger;
  
  
  /**
   * An implementation of {@link LoggerFactoryAdapter} which always returns
   * {@link SimpleLogger} instances.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class SimpleLoggerFA implements LoggerFactoryAdapter {
  
    Map map;
    
    public SimpleLoggerFA() {
      map = new HashMap();
    }
  
  
    /**
     * Return an appropriate {@link SimpleLogger} instance by name. At this time,
     * 
     */
    /**
     * Return an appropriate {@link SimpleLogger} instance.
     * */
    public ULogger getLogger(String name) {
      ULogger ulogger = (ULogger) map.get(name);
      if(ulogger == null) {
        ulogger = new SimpleLogger(name);
        map.put(name, ulogger);
      }
      return ulogger;
    }
  
    /*
     *  (non-Javadoc)
     * @see org.slf4j.LoggerFactoryAdapter#getLogger(java.lang.String, java.lang.String)
     */
    public ULogger getLogger(String domainName, String subDomainName) {
      return getLogger(domainName);
    }
    
    
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/MessageFormatter.java
  
  Index: MessageFormatter.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  
  /**
   * Formats messages according to very simple rules. 
   * See {@link #format(String, Object)} and 
   * {@link #format(String, Object, Object)} for more details.
   *
   * @author Ceki G&uuml;lc&uuml;
   */
  public class MessageFormatter {
    static final char DELIM_START = '{';
    static final char DELIM_STOP = '}';
  
    /**
     * Performs single argument substitution for the 'messagePattern' passed as
     * parameter.
     * <p>
     * For example, <code>MessageFormatter.format("Hi {}.", "there");</code> will
     * return the string "Hi there.".
     * <p>
     * The {} pair is called the formatting element. It serves to designate the
     * location where the argument needs to be inserted within the pattern.
     * 
     * @param messagePattern The message pattern which will be parsed and formatted
     * @param argument The argument to be inserted instead of the formatting element
     * @return The formatted message
     */
    public static String format(String messagePattern, Object argument) {
      int j = messagePattern.indexOf(DELIM_START);
      int len = messagePattern.length();
      char escape = 'x';
  
      // if there are no { characters or { is the last character of the messsage
      // then we just return messagePattern
      if (j == -1 || (j+1 == len)) {
        return messagePattern;
      } else {
        if(j+1 == len) {
        }
        
        char delimStop = messagePattern.charAt(j + 1);
        if (j > 0) {
          escape = messagePattern.charAt(j - 1);
        }
        if ((delimStop != DELIM_STOP) || (escape == '\\')) {
          // invalid DELIM_START/DELIM_STOP pair or espace character is
          // present
          return messagePattern;
        } else {
          StringBuffer sbuf = new StringBuffer(len + 20);
          sbuf.append(messagePattern.substring(0, j));
          sbuf.append(argument);
          sbuf.append(messagePattern.substring(j + 2));
          return sbuf.toString();
        }
      }
    }
  
    /**
     * /**
     * Performs a two argument substitution for the 'messagePattern' passed as
     * parameter.
     * <p>
     * For example, <code>MessageFormatter.format("Hi {}. My name is {}.", 
     * "there", "David");</code> will return the string "Hi there. My name is David.".
     * <p>
     * The '{}' pair is called a formatting element. It serves to designate the
     * location where the arguments need to be inserted within the message pattern.
     * 
     * @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
     * @return The formatted message
     */
    public static String format(String messagePattern, Object arg1, Object arg2) {
      int i = 0;
      int len = messagePattern.length();
      int j = messagePattern.indexOf(DELIM_START);
  
      StringBuffer sbuf = new StringBuffer(messagePattern.length() + 50);
  
      for (int L = 0; L < 2; L++) {
        j = messagePattern.indexOf(DELIM_START, i);
  
        if (j == -1 || (j+1 == len)) {
          // no more variables
          if (i == 0) { // this is a simple string
            return messagePattern;
          } else { // add the tail string which contains no variables and return the result.
            sbuf.append(messagePattern.substring(i, messagePattern.length()));
            return sbuf.toString();
          }
        } else {
          char delimStop = messagePattern.charAt(j + 1);
          if ((delimStop != DELIM_STOP)) {
            // invalid DELIM_START/DELIM_STOP pair
            sbuf.append(messagePattern.substring(i, messagePattern.length()));
            return sbuf.toString();
          }
          sbuf.append(messagePattern.substring(i, j));
          sbuf.append((L == 0) ? arg1 : arg2);
          i = j + 2;
        }
      }
      // append the characters following the second {} pair.
      sbuf.append(messagePattern.substring(i, messagePattern.length()));
      return sbuf.toString();
    }
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/JDK14LoggerFA.java
  
  Index: JDK14LoggerFA.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.LoggerFactoryAdapter;
  import org.slf4j.ULogger;
  
  import java.util.HashMap;
  import java.util.Map;
  import java.util.logging.Logger;
  
  
  /**
   *
   * @author Ceki G&uuml;lc&uuml;
   */
  public class JDK14LoggerFA implements LoggerFactoryAdapter {
    Map map;
  
    public JDK14LoggerFA() {
      map = new HashMap();
    }
  
    /* (non-Javadoc)
     * @see org.slf4j.LoggerFactoryAdapter#getLogger(java.lang.String)
     */
    public ULogger getLogger(String name) {
      ULogger ulogger = (ULogger) map.get(name);
      if (ulogger == null) {
        Logger logger = Logger.getLogger(name);
        ulogger = new JDK14Logger(logger);
        map.put(name, ulogger);
      }
      return ulogger;
    }
  
    /* (non-Javadoc)
     * @see org.slf4j.LoggerFactoryAdapter#getLogger(java.lang.String, java.lang.String)
     */
    public ULogger getLogger(String domainName, String subDomainName) {
      return getLogger(domainName);
    }
  }
  
  
  
  1.1                  logging-log4j/src/filtered-java/org/slf4j/impl/JDK14Logger.java
  
  Index: JDK14Logger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   * 
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  import org.slf4j.ULogger;
  
  import java.util.logging.Level;
  import java.util.logging.Logger;
  
  
  /**
   * A wrapper over @{link java.utill.Logger} which conforms to the 
   * {@link ULogger} interface.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class JDK14Logger implements ULogger {
    final Logger logger;
  
    // WARN: JDK14Logger constructor should have only package access so that
    // only JDK14LoggerFA be able to create one.
    JDK14Logger(Logger logger) {
      this.logger = logger;
    }
  
    /**
     * Is the logger instance enabled for the DEBUG level?
     * @return
     */
    public boolean isDebugEnabled() {
      return logger.isLoggable(Level.FINE);
    }
  
    //
  
    /**
     * Log a message object with the DEBUG level.
     * @param msg - the message object to be logged
     */
    public void debug(Object msg) {
      logger.fine(String.valueOf(msg));
    }
  
    /**
     * Log a parameterized message object at the DEBUG level.
     *
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the parameter
     */
    public void debug(Object parameterizedMsg, Object param1) {
      if (logger.isLoggable(Level.FINE)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1);
          logger.fine(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.fine(parameterizedMsg.toString());
        }
      }
    }
  
    /**
     * Log a parameterized message object at the DEBUG level.
     *
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the first parameter
     * @param param2 - the second parameter
     */
    public void debug(String parameterizedMsg, Object param1, Object param2) {
      if (logger.isLoggable(Level.FINE)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1, param2);
          logger.fine(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.fine(parameterizedMsg.toString());
        }
      }
    }
  
    public void debug(Object msg, Throwable t) {
      logger.log(Level.FINE, msg.toString(), t);
    }
  
    public boolean isInfoEnabled() {
      return logger.isLoggable(Level.INFO);
    }
  
    public void info(Object msg) {
      logger.info(msg.toString());
    }
  
    public void info(Object parameterizedMsg, Object param1) {
      if (logger.isLoggable(Level.INFO)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1);
          logger.info(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.info(parameterizedMsg.toString());
        }
      }
    }
  
    public void info(String parameterizedMsg, Object param1, Object param2) {
      if (logger.isLoggable(Level.INFO)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1, param2);
          logger.info(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.info(parameterizedMsg.toString());
        }
      }
    }
  
    public void info(Object msg, Throwable t) {
      logger.log(Level.INFO, msg.toString(), t);
    }
  
    public boolean isWarnEnabled() {
      return logger.isLoggable(Level.WARNING);
    }
  
    public void warn(Object msg) {
      logger.warning(msg.toString());
    }
  
    public void warn(Object parameterizedMsg, Object param1) {
      if (logger.isLoggable(Level.WARNING)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1);
          logger.warning(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.warning(parameterizedMsg.toString());
        }
      }
    }
  
    public void warn(String parameterizedMsg, Object param1, Object param2) {
      if (logger.isLoggable(Level.WARNING)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1, param2);
          logger.warning(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.warning(parameterizedMsg.toString());
        }
      }
    }
  
    public void warn(Object msg, Throwable t) {
      logger.log(Level.WARNING, msg.toString(), t);
    }
  
    public boolean isErrorEnabled() {
      return logger.isLoggable(Level.SEVERE);
    }
  
    public void error(Object msg) {
      logger.severe(msg.toString());
    }
  
    public void error(Object parameterizedMsg, Object param1) {
      if (logger.isLoggable(Level.WARNING)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1);
          logger.severe(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.severe(parameterizedMsg.toString());
        }
      }
    }
    
    public void error(String parameterizedMsg, Object param1, Object param2) {
      if (logger.isLoggable(Level.WARNING)) {
        if (parameterizedMsg instanceof String) {
          String msgStr = (String) parameterizedMsg;
          msgStr = MessageFormatter.format(msgStr, param1, param2);
          logger.severe(msgStr);
        } else {
          // To be failsafe, we handle the case where 'messagePattern' is not
          // a String. Unless the user makes a mistake, this should not happen.
          logger.severe(parameterizedMsg.toString());
        }
      }
    }
    public void error(Object msg, Throwable t) {
      logger.log(Level.SEVERE, msg.toString(), t);
    }
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/impl/SimpleLoggerFA.java
  
  Index: SimpleLoggerFA.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import org.slf4j.LoggerFactoryAdapter;
  import org.slf4j.ULogger;
  
  
  /**
   * An implementation of {@link LoggerFactoryAdapter} which always returns
   * {@link SimpleLogger} instances.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class SimpleLoggerFA implements LoggerFactoryAdapter {
  
    Map map;
    
    public SimpleLoggerFA() {
      map = new HashMap();
    }
  
  
    /**
     * Return an appropriate {@link SimpleLogger} instance by name. At this time,
     * 
     */
    /**
     * Return an appropriate {@link SimpleLogger} instance.
     * */
    public ULogger getLogger(String name) {
      ULogger ulogger = (ULogger) map.get(name);
      if(ulogger == null) {
        ulogger = new SimpleLogger(name);
        map.put(name, ulogger);
      }
      return ulogger;
    }
  
    /*
     *  (non-Javadoc)
     * @see org.slf4j.LoggerFactoryAdapter#getLogger(java.lang.String, java.lang.String)
     */
    public ULogger getLogger(String domainName, String subDomainName) {
      return getLogger(domainName);
    }
    
    
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/impl/NOPLogger.java
  
  Index: NOPLogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.ULogger;
  
  
  /**
   * A no operation (NOP) implementation of {@link ULogger}.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class NOPLogger implements ULogger {
  
    /**
     * The unique instance of NOPLogger.
     */
    public final static NOPLogger NOP_LOGGER = new NOPLogger();
    
    /**
     * There is no point in people creating multiple instances of NullLogger. 
     * Hence, the private access modifier. 
     */
    private NOPLogger() {
    }
    
    /* Always returns false.
     * 
     * @see org.slf4j.Logger#isDebugEnabled()
     */
    public boolean isDebugEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object)
     */
    public void debug(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Object)
     */
    public void debug(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void debug(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#debug(java.lang.Object, java.lang.Throwable)
     */
    public void debug(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isInfoEnabled()
     */
    public boolean isInfoEnabled() {
      // NOP
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object)
     */
    public void info(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object)
     */
    public void info(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void info(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Throwable)
     */
    public void info(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isWarnEnabled()
     */
    public boolean isWarnEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object)
     */
    public void warn(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object)
     */
    public void warn(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void warn(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Throwable)
     */
    public void warn(Object msg, Throwable t) {
      // NOP
    }
  
    /* Always returns false.
     * @see org.slf4j.Logger#isErrorEnabled()
     */
    public boolean isErrorEnabled() {
      return false;
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object)
     */
    public void error(Object msg) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Object)
     */
    public void error(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Object, java.lang.Object)
     */
    public void error(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /* A NOP implementation.
     * @see org.slf4j.Logger#error(java.lang.Object, java.lang.Throwable)
     */
    public void error(Object msg, Throwable t) {
      // NOP
    }
  
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/impl/MessageFormatter.java
  
  Index: MessageFormatter.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  
  /**
   * Formats messages according to very simple rules. 
   * See {@link #format(String, Object)} and 
   * {@link #format(String, Object, Object)} for more details.
   *
   * @author Ceki G&uuml;lc&uuml;
   */
  public class MessageFormatter {
    static final char DELIM_START = '{';
    static final char DELIM_STOP = '}';
  
    /**
     * Performs single argument substitution for the 'messagePattern' passed as
     * parameter.
     * <p>
     * For example, <code>MessageFormatter.format("Hi {}.", "there");</code> will
     * return the string "Hi there.".
     * <p>
     * The {} pair is called the formatting element. It serves to designate the
     * location where the argument needs to be inserted within the pattern.
     * 
     * @param messagePattern The message pattern which will be parsed and formatted
     * @param argument The argument to be inserted instead of the formatting element
     * @return The formatted message
     */
    public static String format(String messagePattern, Object argument) {
      int j = messagePattern.indexOf(DELIM_START);
      int len = messagePattern.length();
      char escape = 'x';
  
      // if there are no { characters or { is the last character of the messsage
      // then we just return messagePattern
      if (j == -1 || (j+1 == len)) {
        return messagePattern;
      } else {
        if(j+1 == len) {
        }
        
        char delimStop = messagePattern.charAt(j + 1);
        if (j > 0) {
          escape = messagePattern.charAt(j - 1);
        }
        if ((delimStop != DELIM_STOP) || (escape == '\\')) {
          // invalid DELIM_START/DELIM_STOP pair or espace character is
          // present
          return messagePattern;
        } else {
          StringBuffer sbuf = new StringBuffer(len + 20);
          sbuf.append(messagePattern.substring(0, j));
          sbuf.append(argument);
          sbuf.append(messagePattern.substring(j + 2));
          return sbuf.toString();
        }
      }
    }
  
    /**
     * /**
     * Performs a two argument substitution for the 'messagePattern' passed as
     * parameter.
     * <p>
     * For example, <code>MessageFormatter.format("Hi {}. My name is {}.", 
     * "there", "David");</code> will return the string "Hi there. My name is David.".
     * <p>
     * The '{}' pair is called a formatting element. It serves to designate the
     * location where the arguments need to be inserted within the message pattern.
     * 
     * @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
     * @return The formatted message
     */
    public static String format(String messagePattern, Object arg1, Object arg2) {
      int i = 0;
      int len = messagePattern.length();
      int j = messagePattern.indexOf(DELIM_START);
  
      StringBuffer sbuf = new StringBuffer(messagePattern.length() + 50);
  
      for (int L = 0; L < 2; L++) {
        j = messagePattern.indexOf(DELIM_START, i);
  
        if (j == -1 || (j+1 == len)) {
          // no more variables
          if (i == 0) { // this is a simple string
            return messagePattern;
          } else { // add the tail string which contains no variables and return the result.
            sbuf.append(messagePattern.substring(i, messagePattern.length()));
            return sbuf.toString();
          }
        } else {
          char delimStop = messagePattern.charAt(j + 1);
          if ((delimStop != DELIM_STOP)) {
            // invalid DELIM_START/DELIM_STOP pair
            sbuf.append(messagePattern.substring(i, messagePattern.length()));
            return sbuf.toString();
          }
          sbuf.append(messagePattern.substring(i, j));
          sbuf.append((L == 0) ? arg1 : arg2);
          i = j + 2;
        }
      }
      // append the characters following the second {} pair.
      sbuf.append(messagePattern.substring(i, messagePattern.length()));
      return sbuf.toString();
    }
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/impl/NOPLoggerFA.java
  
  Index: NOPLoggerFA.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.LoggerFactoryAdapter;
  import org.slf4j.ULogger;
  
  
  /**
   * NOPLoggerFA is am implementation of {@link LoggerFactoryAdapter}
   * which always returns the unique instance of NOPLogger.
   * 
   * @author Ceki Gulcu
   */
  public class NOPLoggerFA implements LoggerFactoryAdapter {
    
    public NOPLoggerFA() {
      // nothing to do
    }
    
    public ULogger getLogger(String name) {
      return NOPLogger.NOP_LOGGER;
    }
    public ULogger getLogger(String domainName, String subDomainName) {
      return NOPLogger.NOP_LOGGER;  
    }  
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/impl/SimpleLogger.java
  
  Index: SimpleLogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * Copyright (c) 2004-2005 QOS.ch
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j.impl;
  
  import org.slf4j.ULogger;
  
  
  /**
   * A simple implementation that logs messages of level INFO or higher on
   * the console (<code>System.out<code>). 
   * <p>
   * The output includes the relative time in milliseconds, thread name, the level,  
   * logger name, and the message followed by the line separator for the host. 
   * In log4j terms it amounts to the "%r  [%t] %level %logger - %m%n" pattern.
   * <pre>
  176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse order.
  225 [main] INFO examples.SortAlgo - Entered the sort method.
  304 [main] INFO SortAlgo.DUMP - Dump of interger array:
  317 [main] INFO SortAlgo.DUMP - Element [0] = 0
  331 [main] INFO SortAlgo.DUMP - Element [1] = 1
  343 [main] INFO examples.Sort - The next log statement should be an error message.
  346 [main] ERROR SortAlgo.DUMP - Tried to dump an uninitialized array.
          at org.log4j.examples.SortAlgo.dump(SortAlgo.java:58)
          at org.log4j.examples.Sort.main(Sort.java:64)
  467 [main] INFO  examples.Sort - Exiting main method.
  </pre>
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public class SimpleLogger implements ULogger {
  
    String loggerName;
    
    /**
     * Mark the time when this class gets loaded into memory.
     */
    static private long startTime = System.currentTimeMillis();
    
    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
    
    static private String INFO_STR = "INFO";
    static private String WARN_STR = "WARN";
    static private String ERROR_STR = "ERROR";
    
    /**
     * Package access allows only {@link SimpleLoggerFA} to instantiate 
     * SimpleLogger instances.
     */
    SimpleLogger(String name) {
      this.loggerName = name;
    }
    
    /**
     * Always returns false.
     */
    public boolean isDebugEnabled() {
      return false;
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object msg) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object parameterizedMsg, Object param1) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(String parameterizedMsg, Object param1, Object param2) {
      // NOP
    }
  
    /**
     * A NOP implementation.
     */
    public void debug(Object msg, Throwable t) {
      // NOP
    }
  
    /**
     * This is our internal implementation for logging regular (non-parameterized)
     * log messages.
     * 
     * @param level
     * @param message
     * @param t
     */
    private void log(String level, String message, Throwable t) {
      StringBuffer buf = new StringBuffer();
      
      long millis  = System.currentTimeMillis();
      buf.append(millis-startTime);
      
      buf.append(" [");
      buf.append(Thread.currentThread().getName());
      buf.append("] ");
      
      buf.append(level);
      buf.append(" ");
      
      buf.append(loggerName);
      buf.append(" - ");
  
      buf.append(message);
  
      buf.append(LINE_SEPARATOR);
      
      System.out.print(buf.toString());
      if(t != null) {
        t.printStackTrace(System.out);
      }
      System.out.flush();
    }
    /**
     * For parameterized messages, first substitute parameters and then log.
     * 
     * @param level
     * @param parameterizedMsg
     * @param param1
     * @param param2
     */
    private void parameterizedLog(String level, Object parameterizedMsg, Object param1, Object param2) {
      if (parameterizedMsg instanceof String) {
        String msgStr = (String) parameterizedMsg;
        msgStr = MessageFormatter.format(msgStr, param1, param2);
        log(level, msgStr, null);
      } else {
        // To be failsafe, we handle the case where 'messagePattern' is not
        // a String. Unless the user makes a mistake, this should not happen.
        log(level, parameterizedMsg.toString(), null);
      }
    }
    
    /**
     * Always returns true.
     */
    public boolean isInfoEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level INFO according
     * to the format outlined above.
     */
    public void info(Object msg) {
      log(INFO_STR, msg.toString(), null);
    }
  
    
    /**
     * Perform single parameter substituion before logging the message of level 
     * INFO according to the format outlined above.
     */
    public void info(Object parameterizedMsg, Object param1) {
      parameterizedLog(INFO_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * INFO according to the format outlined above.
     */
    
    public void info(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(INFO_STR, parameterizedMsg, param1, param2);
    }
  
    /** 
     * Log a message of level INFO, including an exception.
     */
    public void info(Object msg, Throwable t) {
      log(INFO_STR, msg.toString(), t);
    }
  
    /**
     * Always returns true.
     */
    public boolean isWarnEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level WARN according
     * to the format outlined above.
    */
    public void warn(Object msg) {
      log(WARN_STR, msg.toString(), null);
    }
  
    /**
     * Perform single parameter substituion before logging the message of level 
     * WARN according to the format outlined above.
     */
    public void warn(Object parameterizedMsg, Object param1) {
      parameterizedLog(WARN_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * WARN according to the format outlined above.
     */
    public void warn(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(WARN_STR, parameterizedMsg, param1, param2);
    }
  
    /**
     * Log a message of level WARN, including an exception.
     */
    public void warn(Object msg, Throwable t) {
      log(WARN_STR, msg.toString(), t);
    }
  
    /**
     * Always returns true.
     */
    public boolean isErrorEnabled() {
      return true;
    }
  
    /**
     * A simple implementation which always logs messages of level ERROR acoording
     * to the format outlined above.
     */
    public void error(Object msg) {
      log(ERROR_STR, msg.toString(), null);
    }
  
  
    /**
     * Perform single parameter substituion before logging the message of level 
     * ERROR according to the format outlined above.
     */
    public void error(Object parameterizedMsg, Object param1) {
      parameterizedLog(ERROR_STR, parameterizedMsg, param1, null);
    }
  
    /**
     * Perform double parameter substituion before logging the message of level 
     * ERROR according to the format outlined above.
     */
    public void error(String parameterizedMsg, Object param1, Object param2) {
      parameterizedLog(ERROR_STR, parameterizedMsg, param1, param2);
    }
  
    /** 
     * Log a message of level ERROR, including an exception.
     */
    public void error(Object msg, Throwable t) {
      log(ERROR_STR, msg.toString(), t);
    }
  
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/ULogger.java
  
  Index: ULogger.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * 
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  /**
   * 
   * The main user inteface to logging. It is expected that logging
   * takes places through concerete implemetations of the ULogger
   * interface.
   * 
   * @author Ceki G&uuml;lc&uuml;
   */
  public interface ULogger {
  
    /**
     * Is the logger instance enabled for the DEBUG level?
     * @return True if this ULogger is enabled for the DEBUG level,
     * false otherwise.
     */
    public boolean isDebugEnabled();
    
    /**
     * Log a message object with the DEBUG level. 
     * @param msg - the message object to be logged
     */
    public void debug(Object msg);
    
    
    /**
     * Log a parameterized message object at the DEBUG level. 
     * 
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the parameter 
     */
    public void debug(Object parameterizedMsg, Object param1);
    
    /**
     * Log a parameterized message object at the DEBUG level. 
     * 
     * <p>This form is useful in avoiding the superflous object creation
     * problem when invoking this method while it is disabled.
     * </p>
     * @param parameterizedMsg - the parameterized message object
     * @param param1 - the first parameter 
     * @param param2 - the second parameter 
     */
    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(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(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(String parameterizedMsg, Object param1, Object param2);
    public void error(Object msg, Throwable t);
  
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/LoggerFactory.java
  
  Index: LoggerFactory.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   *
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  // WARNING
  // WARNING Modifications MUST be made to the original file found at
  // WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/LoggerFactory.java
  // WARNING
  
  /**
   * The <code>LoggerFactory</code> can produce Loggers for various logging APIs,
   * most notably for log4j, JDK 1.4 logging. Other implemenations such as
   * {@link org.slf4j.impl.NOPLogger NOPLogger} and
   * {@link org.slf4j.impl.SimpleLogger SimpleLogger} are also supported.
   *
   * @author Ceki G&uuml;lc&uuml;
   */
  public class LoggerFactory {
    static LoggerFactoryAdapter adapter;
  
    // 
    // WARNING Modify the original in
    //         $SLF4J_HOME/src/filtered-java/org/slf4j/
    
    static {
      String adapterClassStr = "org.slf4j.impl.Log4jLoggerFA";
      System.out.println("SLF4J built for "+adapterClassStr);
      try {
        adapter = new org.slf4j.impl.Log4jLoggerFA();
      } catch (Exception e) {
        // unless there was a problem with the build or the JVM we will never
        // get exceptions
        System.err.println(
          "Could not instantiate instance of class [" + adapterClassStr + "]");
        e.printStackTrace();
      }
    }
  
    public static ULogger getLogger(String name) {
      return adapter.getLogger(name);
    }
  
    public static ULogger getLogger(String domainName, String subDomainName) {
      return adapter.getLogger(domainName, subDomainName);
    }
  
    public static ULogger getLogger(Class clazz) {
      return adapter.getLogger(clazz.getName());
    }
  
    public static ULogger getLogger(Class clazz, String subDomainName) {
      return adapter.getLogger(clazz.getName(), subDomainName);
    }
  }
  
  
  
  1.1                  logging-log4j/src/java/org/slf4j/LoggerFactoryAdapter.java
  
  Index: LoggerFactoryAdapter.java
  ===================================================================
  /* 
   * Copyright (c) 2004-2005 SLF4J.ORG
   * 
   * All rights reserved.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files (the
   * "Software"), to  deal in  the Software without  restriction, including
   * without limitation  the rights to  use, copy, modify,  merge, publish,
   * distribute, and/or sell copies of  the Software, and to permit persons
   * to whom  the Software is furnished  to do so, provided  that the above
   * copyright notice(s) and this permission notice appear in all copies of
   * the  Software and  that both  the above  copyright notice(s)  and this
   * permission notice appear in supporting documentation.
   * 
   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
   * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
   * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
   * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
   * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
   * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   * 
   * Except as  contained in  this notice, the  name of a  copyright holder
   * shall not be used in advertising or otherwise to promote the sale, use
   * or other dealings in this Software without prior written authorization
   * of the copyright holder.
   *
   */
  
  package org.slf4j;
  
  /**
   * LoggerFactoryAdapter interface is used internally by {@link
   * LoggerFactory}.
   * 
   * <p>Only developers wishing to write new UGLI adapters need to worry
   * about this interface.
   * 
   * @author Ceki G&uuml;lc&uuml;
   *
   */
  public interface LoggerFactoryAdapter {
    
    /**
     * Return the appropriate named {@link ULogger} instance.
     */
    public ULogger getLogger(String name);
    
    /**
     * Return a {@link ULogger} instance in <code>domain</code>, <code>subDomain</code>. 
     *
     * @param domain
     * @param subDomain
     * @return ULogger instance
     */
    public ULogger getLogger(String domain, String subDomain);  
  }
  
  
  

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