You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by bl...@apache.org on 2003/12/17 14:36:28 UTC

cvs commit: jakarta-pluto/src/portal/org/apache/pluto/portalImpl/services/log LogServiceCommonsLoggingImpl.java

blumm       2003/12/17 05:36:28

  Modified:    war/WEB-INF/config services.properties
  Added:       lib/portal commons-logging-api.jar
               src/portal/org/apache/pluto/portalImpl/services/log
                        LogServiceCommonsLoggingImpl.java
  Log:
  This patch enables 'commons logging'. Please take a look at
  jakarta-pluto\war\WEB-INF\config\services.properties. There
  you can switch between the Pluto's 'traditional' logging
  and the 'commons logging'.
  PR:
  Submitted by:	Nick Lothian/nl@essential.com.au
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  jakarta-pluto/lib/portal/commons-logging-api.jar
  
  	<<Binary file>>
  
  
  1.3       +3 -1      jakarta-pluto/war/WEB-INF/config/services.properties
  
  Index: services.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-pluto/war/WEB-INF/config/services.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- services.properties	11 Oct 2003 00:51:43 -0000	1.2
  +++ services.properties	17 Dec 2003 13:36:27 -0000	1.3
  @@ -4,7 +4,9 @@
   
   org.apache.pluto.portalImpl.services.config.ConfigService = org.apache.pluto.portalImpl.services.config.ConfigServiceImpl
   
  -org.apache.pluto.portalImpl.services.log.LogService = org.apache.pluto.portalImpl.services.log.LogServiceImpl
  +# LogServiceImpl writes to System.out. LogServiceCommonsLoggingImpl uses commons-logging
  +#org.apache.pluto.portalImpl.services.log.LogService = org.apache.pluto.portalImpl.services.log.LogServiceImpl
  +org.apache.pluto.portalImpl.services.log.LogService = org.apache.pluto.portalImpl.services.log.LogServiceCommonsLoggingImpl
   
   org.apache.pluto.portalImpl.services.factorymanager.FactoryManagerService = org.apache.pluto.portalImpl.services.factorymanager.FactoryManagerServiceImpl
   
  
  
  
  1.1                  jakarta-pluto/src/portal/org/apache/pluto/portalImpl/services/log/LogServiceCommonsLoggingImpl.java
  
  Index: LogServiceCommonsLoggingImpl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Pluto", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.pluto.portalImpl.services.log;
  
  import org.apache.commons.logging.LogFactory;
  
  /**
   * <p>Implementation of LogServiceImpl which uses commons-logging to do logging.</p>
   *
   * <p>To configure Pluto to use this implementation, set the property org.apache.pluto.portalImpl.services.log.LogService
   * in services.properties to the this class.</p>
   *
   * @author Nick Lothian
   *
   */
  public class LogServiceCommonsLoggingImpl extends LogService {
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#isDebugEnabled(java.lang.String)
  	 */
  	public boolean isDebugEnabled(String aComponent) {
  		return LogFactory.getLog(aComponent).isDebugEnabled();
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#isInfoEnabled(java.lang.String)
  	 */
  	public boolean isInfoEnabled(String aComponent) {
  		return LogFactory.getLog(aComponent).isInfoEnabled();
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#isWarnEnabled(java.lang.String)
  	 */
  	public boolean isWarnEnabled(String aComponent) {
  		return LogFactory.getLog(aComponent).isWarnEnabled();
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#isErrorEnabled(java.lang.String)
  	 */
  	public boolean isErrorEnabled(String aComponent) {
  		return LogFactory.getLog(aComponent).isErrorEnabled();
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#debug(java.lang.String, java.lang.String)
  	 */
  	public void debug(String aComponent, String aMessage) {
  		LogFactory.getLog(aComponent).debug(aMessage);
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#debug(java.lang.String, java.lang.String, java.lang.Throwable)
  	 */
  	public void debug(String aComponent, String aMessage, Throwable aThrowable) {
  		LogFactory.getLog(aComponent).debug(aMessage, aThrowable);
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#info(java.lang.String, java.lang.String)
  	 */
  	public void info(String aComponent, String aMessage) {
  		LogFactory.getLog(aComponent).info(aMessage);
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#warn(java.lang.String, java.lang.String)
  	 */
  	public void warn(String aComponent, String aMessage) {
  		LogFactory.getLog(aComponent).warn(aMessage);
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#error(java.lang.String, java.lang.String, java.lang.Throwable)
  	 */
  	public void error(String aComponent, String aMessage, Throwable aThrowable) {
  		LogFactory.getLog(aComponent).error(aMessage, aThrowable);
  	}
  
  	/**
  	 * @see org.apache.pluto.services.log.LogService#error(java.lang.String, java.lang.Throwable)
  	 */
  	public void error(String aComponent, Throwable aThrowable) {
  		LogFactory.getLog(aComponent).error(aComponent, aThrowable);
  	}
  }