Return-Path: Delivered-To: apmail-avalon-dev-archive@avalon.apache.org Received: (qmail 68842 invoked by uid 500); 1 May 2003 18:15:52 -0000 Mailing-List: contact dev-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon Developers List" Reply-To: "Avalon Developers List" Delivered-To: mailing list dev@avalon.apache.org Received: (qmail 65248 invoked from network); 1 May 2003 18:14:14 -0000 Message-Id: <5.2.0.9.0.20030501201501.032df470@mail.qos.ch> X-Sender: ceki@mail.qos.ch (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Thu, 01 May 2003 20:15:36 +0200 To: avalon-dev@apache.org From: Ceki =?iso-8859-1?Q?G=FClc=FC?= Subject: Fwd: cvs commit: jakarta-log4j/src/java/org/apache/log4j/varia Log4JAvalonLogger.java Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Subsequent to Peter's patch, log4j now supports an adapter to Avalon logging. >List-Id: "Log4J Developers List" >Reply-To: "Log4J Developers List" >Delivered-To: mailing list log4j-dev@jakarta.apache.org >Date: 1 May 2003 18:08:00 -0000 >From: ceki@apache.org >To: jakarta-log4j-cvs@apache.org >Subject: cvs commit: jakarta-log4j/src/java/org/apache/log4j/varia >Log4JAvalonLogger.java > >ceki 2003/05/01 11:08:00 > > Modified: . build.xml > Added: src/java/org/apache/log4j/varia Log4JAvalonLogger.java > Log: > Log4j now supports Avalon the logger facade. > > Revision Changes Path > 1.59 +26 -4 jakarta-log4j/build.xml > > Index: build.xml > =================================================================== > RCS file: /home/cvs/jakarta-log4j/build.xml,v > retrieving revision 1.58 > retrieving revision 1.59 > diff -u -r1.58 -r1.59 > --- build.xml 21 Apr 2003 14:59:19 -0000 1.58 > +++ build.xml 1 May 2003 18:08:00 -0000 1.59 > @@ -82,6 +82,7 @@ > > > > + > > > > @@ -123,6 +124,17 @@ > > > > + > + + property="avalonFramework-present"> > + > + > + > + > + > + if="avalonFramework-present"> > + > + > > > property="jmx-present"> > @@ -175,7 +187,7 @@ > > depends="init, build.core, build.examples, build.xml, > - build.javamail, build.jms, build.jmx"/> > + build.javamail, build.jms, build.jmx, build.avalonFramework"/> > > > > @@ -190,6 +202,7 @@ > ${stem}/net/SMTPAppender.java, > ${stem}/net/JMS*.java, > ${stem}/jmx/*.java, > + ${stem}/varia/Log4JAvalonLogger.java, > ${stem}/or/jms/*.java" > deprecation="${deprecation}" > debug="on"> > @@ -237,6 +250,15 @@ > tofile="${javac.dest}/${stem}/xml/log4j.dtd" /> > > > + if="avalonFramework-present"> > + + destdir="${javac.dest}" > + deprecation="${deprecation}" > + includes="${stem}/varia/Log4JAvalonLogger.java"> > + > + > + > + > if="javamail-present"> > @@ -302,7 +324,7 @@ > > > > - > + > classname="de.hunsicker.jalopy.plugin.ant.AntPlugin" > classpathref="jalopy.path" /> > @@ -322,7 +344,7 @@ > > > > - > + > classpathref="jalopy.path" > fork="true" /> > @@ -346,7 +368,7 @@ > > > - > + > > > > > > > 1.1 > jakarta-log4j/src/java/org/apache/log4j/varia/Log4JAvalonLogger.java > > Index: Log4JAvalonLogger.java > =================================================================== > /* > * > ============================================================================ > * The Apache Software License, Version 1.1 > * > ============================================================================ > * > * Copyright (C) 1999 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 "log4j" 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. For > more information on the > * Apache Software Foundation, please see . > * > */ > > package org.apache.log4j.varia; > > import org.apache.avalon.framework.logger.Logger; > > import org.apache.log4j.Level; > > > /** > * The default Log4J wrapper class for Avalon Logger. > * > * @author Peter Donald > * @author Berin Loritsch > * @version CVS $Revision: 1.1 $ $Date: 2003/05/01 18:08:00 $ > */ > public final class Log4JAvalonLogger implements Logger { > //underlying implementation > private final org.apache.log4j.Logger m_logger; > > /** > * Create a logger that delegates to specified category. > * > * @param logImpl the category to delegate to > */ > public Log4JAvalonLogger(final org.apache.log4j.Logger 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(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 priority "error" will be logged. > * > * @return true if "error" messages will be logged > */ > public final boolean isErrorEnabled() { > return m_logger.isEnabledFor(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 priority "fatalError" will be logged. > * > * @return true if "fatalError" messages will be logged > */ > public final boolean isFatalErrorEnabled() { > return m_logger.isEnabledFor(Level.FATAL); > } > > /** > * Create a new child logger. > * The name of the child logger is > [current-loggers-name].[passed-in-name] > * Throws IllegalArgumentException 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 Log4JAvalonLogger( > org.apache.log4j.Logger.getLogger(m_logger.getName() + "." + name)); > } > } -- Ceki For log4j documentation consider "The complete log4j manual" http://www.qos.ch/shop/products/clm_t.jsp --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org For additional commands, e-mail: dev-help@avalon.apache.org