avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon/src/proposal/avalon5/org/apache/framework/logger/impl Log4JLogger.java
Date Mon, 16 Dec 2002 16:03:01 GMT
bloritsch    2002/12/16 08:03:00

  Modified:    src/proposal/avalon5/org/apache/framework/logger/impl
                        Log4JLogger.java
  Log:
  update the proposal wrapper with the newer Log4J code
  
  Revision  Changes    Path
  1.5       +249 -246  jakarta-avalon/src/proposal/avalon5/org/apache/framework/logger/impl/Log4JLogger.java
  
  Index: Log4JLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/avalon5/org/apache/framework/logger/impl/Log4JLogger.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Log4JLogger.java	15 Nov 2002 12:50:22 -0000	1.4
  +++ Log4JLogger.java	16 Dec 2002 16:03:00 -0000	1.5
  @@ -1,246 +1,249 @@
  -/*
  -
  - ============================================================================
  -                   The Apache Software License, Version 1.1
  - ============================================================================
  - 
  - Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  - 
  - Redistribution and use in source and binary forms, with or without modifica-
  - tion, 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  acknowledgment:  "This product includes  software
  -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  -    Alternately, this  acknowledgment may  appear in the software itself,  if
  -    and wherever such third-party acknowledgments normally appear.
  - 
  - 4. The names "Jakarta", "Apache Avalon", "Avalon Excalibur", "Avalon
  -    Framework" 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 name,  without prior written permission  of the
  -    Apache Software Foundation.
  - 
  - 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 (INCLU-
  - DING, 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 and was  originally created by
  - Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache 
  - Software Foundation, please see <http://www.apache.org/>.
  - 
  -*/
  -package org.apache.framework.logger.impl;
  -
  -import org.apache.log4j.Category;
  -import org.apache.log4j.Priority;
  -import org.apache.framework.logger.Logger;
  -
  -/**
  - * The default Log4J wrapper class for Logger.
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - */
  -public final class Log4JLogger
  -    implements Logger
  -{
  -    //underlying implementation
  -    private final Category m_logger;
  -
  -    /**
  -     * Create a logger that delegates to specified category.
  -     *
  -     * @param logImpl the category to delegate to
  -     */
  -    public Log4JLogger( final Category logImpl )
  -    {
  -        m_logger = logImpl;
  -    }
  -
  -    /**
  -     * Log a debug message.
  -     *
  -     * @param message the message
  -     */
  -    public final void debug( final String message )
  -    {
  -        m_logger.debug(message);
  -    }
  -
  -    /**
  -     * Log a debug message.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public final void debug( final String message, final Throwable throwable )
  -    {
  -        m_logger.debug( message, throwable );
  -    }
  -
  -    /**
  -     * Determine if messages of priority "debug" will be logged.
  -     *
  -     * @return true if "debug" messages will be logged
  -     */
  -    public final boolean isDebugEnabled()
  -    {
  -        return m_logger.isDebugEnabled();
  -    }
  -
  -    /**
  -     * Log a info message.
  -     *
  -     * @param message the message
  -     */
  -    public final void info( final String message )
  -    {
  -        m_logger.info( message );
  -    }
  -
  -    /**
  -     * Log a info message.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public final void info( final String message, final Throwable throwable )
  -    {
  -        m_logger.info( message, throwable );
  -    }
  -
  -    /**
  -     * Determine if messages of priority "info" will be logged.
  -     *
  -     * @return true if "info" messages will be logged
  -     */
  -    public final boolean isInfoEnabled()
  -    {
  -        return m_logger.isInfoEnabled();
  -    }
  -
  -    /**
  -     * Log a warn message.
  -     *
  -     * @param message the message
  -     */
  -    public final void warn( final String message )
  -    {
  -        m_logger.warn( message );
  -    }
  -
  -    /**
  -     * Log a warn message.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public final void warn( final String message, final Throwable throwable )
  -    {
  -        m_logger.warn( message, throwable );
  -    }
  -
  -    /**
  -     * Determine if messages of priority "warn" will be logged.
  -     *
  -     * @return true if "warn" messages will be logged
  -     */
  -    public final boolean isWarnEnabled()
  -    {
  -        return m_logger.isEnabledFor( Priority.WARN );
  -    }
  -
  -    /**
  -     * Log a error message.
  -     *
  -     * @param message the message
  -     */
  -    public final void error( final String message )
  -    {
  -        m_logger.error( message );
  -    }
  -
  -    /**
  -     * Log a error message.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public final void error( final String message, final Throwable throwable )
  -    {
  -        m_logger.error( message, throwable );
  -    }
  -
  -    /**
  -     * Determine if messages of priority "error" will be logged.
  -     *
  -     * @return true if "error" messages will be logged
  -     */
  -    public final boolean isErrorEnabled()
  -    {
  -        return m_logger.isEnabledFor( Priority.ERROR );
  -    }
  -
  -    /**
  -     * Log a fatalError message.
  -     *
  -     * @param message the message
  -     */
  -    public final void fatalError( final String message )
  -    {
  -        m_logger.fatal( message );
  -    }
  -
  -    /**
  -     * Log a fatalError message.
  -     *
  -     * @param message the message
  -     * @param throwable the throwable
  -     */
  -    public final void fatalError( final String message, final Throwable throwable )
  -    {
  -        m_logger.fatal( message, throwable );
  -    }
  -
  -    /**
  -     * Determine if messages of priority "fatalError" will be logged.
  -     *
  -     * @return true if "fatalError" messages will be logged
  -     */
  -    public final boolean isFatalErrorEnabled()
  -    {
  -        return m_logger.isEnabledFor( Priority.FATAL );
  -    }
  -
  -    /**
  -     * Create a new child logger.
  -     * The name of the child logger is [current-loggers-name].[passed-in-name]
  -     * Throws <code>IllegalArgumentException</code> if name has an empty element
name
  -     *
  -     * @param name the subname of this logger
  -     * @return the new logger
  -     */
  -    public final Logger getChildLogger( final String name )
  -    {
  -        return new Log4JLogger( Category.getInstance( m_logger.getName() + "." + name )
);
  -    }
  -}
  +/* ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1997-2002 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 acknowledgment:
  + *    "This product includes software developed by the
  + *    Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software
  + *    itself, if and wherever such third-party acknowledgments
  + *    normally appear.
  + *
  + * 4. The names "Jakarta", "Avalon", 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 name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * 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.framework.logger.impl;
  +
  +import org.apache.framework.logger.Logger;
  +
  +
  +/**
  + * The default Log4J wrapper class for Logger.
  + *
  + * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
  + */
  +public final class Log4JLogger
  +    implements Logger
  +{
  +    //underlying implementation
  +    private final org.apache.log4j.Logger  m_logger;
  +
  +    /**
  +     * Create a logger that delegates to specified Log4J logger.
  +     *
  +     * @param logger the Log4J logger to delegate to
  +     */
  +    public Log4JLogger( final org.apache.log4j.Logger logger )
  +    {
  +        m_logger = logger;
  +    }
  +
  +    /**
  +     * Log a debug message.
  +     *
  +     * @param message the message
  +     */
  +    public final void debug( final String message )
  +    {
  +        m_logger.debug( message );
  +    }
  +
  +    /**
  +     * Log a debug message.
  +     *
  +     * @param message the message
  +     * @param throwable the throwable
  +     */
  +    public final void debug( final String message, final Throwable throwable )
  +    {
  +        m_logger.debug( message, throwable );
  +    }
  +
  +    /**
  +     * Determine if messages of level "debug" will be logged.
  +     *
  +     * @return true if "debug" messages will be logged
  +     */
  +    public final boolean isDebugEnabled()
  +    {
  +        return m_logger.isDebugEnabled();
  +    }
  +
  +    /**
  +     * Log a info message.
  +     *
  +     * @param message the message
  +     */
  +    public final void info( final String message )
  +    {
  +        m_logger.info( message );
  +    }
  +
  +    /**
  +     * Log a info message.
  +     *
  +     * @param message the message
  +     * @param throwable the throwable
  +     */
  +    public final void info( final String message, final Throwable throwable )
  +    {
  +        m_logger.info( message, throwable );
  +    }
  +
  +    /**
  +     * Determine if messages of level "info" will be logged.
  +     *
  +     * @return true if "info" messages will be logged
  +     */
  +    public final boolean isInfoEnabled()
  +    {
  +        return m_logger.isInfoEnabled();
  +    }
  +
  +    /**
  +     * Log a warn message.
  +     *
  +     * @param message the message
  +     */
  +    public final void warn( final String message )
  +    {
  +        m_logger.warn( message );
  +    }
  +
  +    /**
  +     * Log a warn message.
  +     *
  +     * @param message the message
  +     * @param throwable the throwable
  +     */
  +    public final void warn( final String message, final Throwable throwable )
  +    {
  +        m_logger.warn( message, throwable );
  +    }
  +
  +    /**
  +     * Determine if messages of level "warn" will be logged.
  +     *
  +     * @return true if "warn" messages will be logged
  +     */
  +    public final boolean isWarnEnabled()
  +    {
  +        return m_logger.isEnabledFor( org.apache.log4j.Level.WARN );
  +    }
  +
  +    /**
  +     * Log a error message.
  +     *
  +     * @param message the message
  +     */
  +    public final void error( final String message )
  +    {
  +        m_logger.error( message );
  +    }
  +
  +    /**
  +     * Log a error message.
  +     *
  +     * @param message the message
  +     * @param throwable the throwable
  +     */
  +    public final void error( final String message, final Throwable throwable )
  +    {
  +        m_logger.error( message, throwable );
  +    }
  +
  +    /**
  +     * Determine if messages of level "error" will be logged.
  +     *
  +     * @return true if "error" messages will be logged
  +     */
  +    public final boolean isErrorEnabled()
  +    {
  +        return m_logger.isEnabledFor( org.apache.log4j.Level.ERROR );
  +    }
  +
  +    /**
  +     * Log a fatalError message.
  +     *
  +     * @param message the message
  +     */
  +    public final void fatalError( final String message )
  +    {
  +        m_logger.fatal( message );
  +    }
  +
  +    /**
  +     * Log a fatalError message.
  +     *
  +     * @param message the message
  +     * @param throwable the throwable
  +     */
  +    public final void fatalError( final String message, final Throwable throwable )
  +    {
  +        m_logger.fatal( message, throwable );
  +    }
  +
  +    /**
  +     * Determine if messages of level "fatalError" will be logged.
  +     *
  +     * @return true if "fatalError" messages will be logged
  +     */
  +    public final boolean isFatalErrorEnabled()
  +    {
  +        return m_logger.isEnabledFor( org.apache.log4j.Level.FATAL );
  +    }
  +
  +    /**
  +     * Create a new child logger.
  +     * The name of the child logger is [current-loggers-name].[passed-in-name]
  +     * Throws <code>IllegalArgumentException</code> if name has an empty element
name
  +     *
  +     * @param name the subname of this logger
  +     * @return the new logger
  +     */
  +    public final Logger getChildLogger( final String name )
  +    {
  +        return new Log4JLogger( org.apache.log4j.Logger.getLogger( m_logger.getName() +
"." + name ) );
  +    }
  +}
  +
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message