tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger Constants.java FileLogger.java LoggerBase.java SystemErrLogger.java SystemOutLogger.java LocalStrings.properties
Date Thu, 20 Jan 2000 06:36:30 GMT
craigmcc    00/01/19 22:36:29

  Added:       proposals/catalina/src/share/org/apache/tomcat/logger
                        Constants.java FileLogger.java LoggerBase.java
                        SystemErrLogger.java SystemOutLogger.java
                        LocalStrings.properties
  Log:
  Check-in of logger component implementations for the
  "Catalina" proposal.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/Constants.java
  
  Index: Constants.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
   * 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", "Tomcat", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.logger;
  
  /**
   * Manifest constants for the <code>org.apache.tomcat.logger</code>
   * package.
   *
   * @author Craig R. McClanahan
   */
  
  public class Constants {
  
      public static final String Package = "org.apache.tomcat.logger";
  
  }
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java
  
  Index: FileLogger.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java,v
1.1 2000/01/20 06:36:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/01/20 06:36:29 $
   *
   * ====================================================================
   *
   * 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
   * 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", "Tomcat", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.logger;
  
  
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.sql.Timestamp;
  import org.apache.tomcat.Lifecycle;
  import org.apache.tomcat.LifecycleException;
  import org.apache.tomcat.util.StringManager;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  
  
  /**
   * Implementation of <b>Logger</b> that appends log messages to a file
   * named {prefix}.{date}.{suffix} in a configured directory, with an
   * optional preceding timestamp.
   * <p>
   * Lifecycle configuration of this component assumes an XML node
   * in the following format:
   * <code>
   *   &lt;Logger className="org.apache.tomcat.logger.FileLogger"
   *           directory="./LOG" prefix="tomcat." suffix=".log"
   *           timestamp="false"/>
   * </code>
   * where you can adjust the following parameters, with default values
   * in square brackets:
   * <ul>
   * <li><b>directory</b> - Pathname of the directory in which log files
are
   *     created.  [./LOG]
   * <li><b>prefix</b> - Prefix string added to the start of log file
   *     pathnames.  [tomcat.]
   * <li><b>suffix</b> - Suffix string added to the end of log file
   *     pathnames.  [.log]
   * <li><b>timestamp</b> - <code>true</code> if logged messages
should be
   *     date/time stamped, else <code>false</code>.  [timestamp]
   * </ul>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/01/20 06:36:29 $
   */
  
  public final class FileLogger
      extends LoggerBase
      implements Lifecycle {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * Has this component been configured?
       */
      private boolean configured = false;
  
  
      /**
       * The as-of date for the currently open log file, or a zero-length
       * string if there is no open log file.
       */
      private String date = "";
  
  
      /**
       * The directory in which log files are created.
       */
      private String directory = "./LOG";
  
  
      /**
       * The descriptive information about this implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.logger.FileLogger/1.0";
  
  
      /**
       * The prefix that is added to log file filenames.
       */
      private String prefix = "tomcat.";
  
  
      /**
       * The string manager for this package.
       */
      private StringManager sm =
  	StringManager.getManager(Constants.Package);
  
  
      /**
       * Has this component been started?
       */
      private boolean started = false;
  
  
      /**
       * The suffix that is added to log file filenames.
       */
      private String suffix = ".log";
  
  
      /**
       * Should logged messages be date/time stamped?
       */
      private boolean timestamp = false;
  
  
      /**
       * The PrintWriter to which we are currently logging, if any.
       */
      private PrintWriter writer = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the directory in which we create log files.
       */
      public String getDirectory() {
  
  	return (directory);
  
      }
  
  
      /**
       * Set the directory in which we create log files.
       *
       * @param directory The new log file directory
       */
      public void setDirectory(String directory) {
  
  	this.directory = directory;
  
      }
  
  
      /**
       * Return the log file prefix.
       */
      public String getPrefix() {
  
  	return (prefix);
  
      }
  
  
      /**
       * Set the log file prefix.
       *
       * @param prefix The new log file prefix
       */
      public void setPrefix(String prefix) {
  
  	this.prefix = prefix;
  
      }
  
  
      /**
       * Return the log file suffix.
       */
      public String getSuffix() {
  
  	return (suffix);
  
      }
  
  
      /**
       * Set the log file suffix.
       *
       * @param suffix The new log file suffix
       */
      public void setSuffix(String suffix) {
  
  	this.suffix = suffix;
  
      }
  
  
      /**
       * Return the timestamp flag.
       */
      public boolean getTimestamp() {
  
  	return (timestamp);
  
      }
  
  
      /**
       * Set the timestamp flag.
       *
       * @param timestamp The new timestamp flag
       */
      public void setTimestamp(boolean timestamp) {
  
  	this.timestamp = timestamp;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Writes the specified message to a servlet log file, usually an event
       * log.  The name and type of the servlet log is specific to the
       * servlet container.
       *
       * @param msg A <code>String</code> specifying the message to be written
       *  to the log file
       */
      public void log(String msg) {
  
  	// Construct the timestamp we will use, if requested
  	Timestamp ts = new Timestamp(System.currentTimeMillis());
  	String tsString = ts.toString().substring(0, 19);
  	String tsDate = tsString.substring(0, 10);
  
  	// If the date has changed, switch log files
  	if (!date.equals(tsDate)) {
  	    close();
  	    date = tsDate;
  	    open();
  	}
  
  	// Log this message, timestamped if necessary
  	if (writer != null) {
  	    if (timestamp) {
  		writer.print(tsString);
  		writer.print(" ");
  	    }
  	    writer.println(msg);
  	}
  
      }
  
  
      // -------------------------------------------------------- Private Methods
  
  
      /**
       * Close the currently open log file (if any)
       */
      private void close() {
  
  	if (writer == null)
  	    return;
  	writer.flush();
  	writer.close();
  	writer = null;
  	date = "";
  
      }
  
  
      /**
       * Open the new log file for the date specified by <code>date</code>.
       */
      private void open() {
  
  	// Create the directory if necessary
  	File dir = new File(directory);
  	dir.mkdirs();
  
  	// Open the current log file
  	try {
  	    String pathname = directory +
  		System.getProperty("file.separator") +
  		prefix + date + suffix;
  	    writer = new PrintWriter(new FileWriter(pathname, true), true);
  	} catch (IOException e) {
  	    writer = null;
  	}
  
      }
  
  
      // ------------------------------------------------------ Lifecycle Methods
  
  
      /**
       * Configure this component, based on the specified configuration
       * parameters.  This method should be called immediately after the
       * component instance is created, and before <code>start()</code>
       * is called.
       *
       * @param parameters Configuration parameters for this component
       *  (<B>FIXME: What object type should this really be?)
       *
       * @exception IllegalStateException if this component has already been
       *  configured and/or started
       * @exception LifecycleException if this component detects a fatal error
       *  in the configuration parameters it was given
       */
      public void configure(Node parameters)
  	throws LifecycleException {
  
  	// Validate and update our current component state
  	if (configured)
  	    throw new LifecycleException
  		(sm.getString("fileLogger.alreadyConfigured"));
  	configured = true;
  	if (parameters == null)
  	    return;
  
  	// Parse and process our configuration parameters
  	if (!("Logger".equals(parameters.getNodeName())))
  	    return;
  	NamedNodeMap attributes = parameters.getAttributes();
  	Node node = null;
  
  	node = attributes.getNamedItem("directory");
  	if (node != null) {
  	    try {
  		setDirectory(node.getNodeValue());
  	    } catch (Throwable t) {
  		;	// XXX - Throw exception?
  	    }
  	}
  
  	node = attributes.getNamedItem("prefix");
  	if (node != null) {
  	    try {
  		setPrefix(node.getNodeValue());
  	    } catch (Throwable t) {
  		;	// XXX - Throw exception?
  	    }
  	}
  
  	node = attributes.getNamedItem("suffix");
  	if (node != null) {
  	    try {
  		setSuffix(node.getNodeValue());
  	    } catch (Throwable t) {
  		;	// XXX - Throw exception?
  	    }
  	}
  
  	node = attributes.getNamedItem("timestamp");
  	if (node != null) {
  	    try {
  		String value = node.getNodeValue().toLowerCase();
  		setTimestamp(value.equals("true"));
  	    } catch (Throwable t) {
  		;	// XXX - Throw exception?
  	    }
  	}
  
      }
  
  
      /**
       * Prepare for the beginning of active use of the public methods of this
       * component.  This method should be called after <code>configure()</code>,
       * and before any of the public methods of the component are utilized.
       *
       * @exception IllegalStateException if this component has not yet been
       *  configured (if required for this component)
       * @exception IllegalStateException if this component has already been
       *  started
       * @exception LifecycleException if this component detects a fatal error
       *  that prevents this component from being used
       */
      public void start() throws LifecycleException {
  
  	// Validate and update our current component state
  	if (!configured)
  	    throw new LifecycleException
  		(sm.getString("fileLogger.notConfigured"));
  	if (started)
  	    throw new LifecycleException
  		(sm.getString("fileLogger.alreadyStarted"));
  	started = true;
  
      }
  
  
      /**
       * Gracefully terminate the active use of the public methods of this
       * component.  This method should be the last one called on a given
       * instance of this component.
       *
       * @exception IllegalStateException if this component has not been started
       * @exception IllegalStateException if this component has already
       *  been stopped
       * @exception LifecycleException if this component detects a fatal error
       *  that needs to be reported
       */
      public void stop() throws LifecycleException {
  
  	// Validate and update our current component state
  	if (!started)
  	    throw new LifecycleException
  		(sm.getString("fileLogger.notStarted"));
  	started = false;
  
  	close();
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java
  
  Index: LoggerBase.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java,v
1.1 2000/01/20 06:36:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/01/20 06:36:29 $
   *
   * ====================================================================
   *
   * 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
   * 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", "Tomcat", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.logger;
  
  
  import java.io.CharArrayWriter;
  import java.io.PrintWriter;
  import org.apache.tomcat.Container;
  import org.apache.tomcat.Logger;
  
  
  /**
   * Convenience base class for <b>Logger</b> implementations.  The only
   * method that must be implemented is <code>log(String msg)</code>, plus
   * any property setting and lifecycle methods required for configuration.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/01/20 06:36:29 $
   */
  
  abstract class LoggerBase
      implements Logger {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The Container with which this Logger has been associated.
       */
      protected Container container = null;
  
  
      /**
       * The descriptive information about this implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.logger.LoggerBase/1.0";
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the Container with which this Logger has been associated.
       */
      public Container getContainer() {
  
  	return (container);
  
      }
  
  
      /**
       * Set the Container with which this Logger has been associated.
       *
       * @param container The associated Container
       */
      public void setContainer(Container container) {
  
  	this.container = container;
  
      }
  
  
      /**
       * Return descriptive information about this Logger implementation and
       * the corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
  	return (info);
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Writes the specified message to a servlet log file, usually an event
       * log.  The name and type of the servlet log is specific to the
       * servlet container.
       *
       * @param msg A <code>String</code> specifying the message to be written
       *  to the log file
       */
      public abstract void log(String msg);
  
  
      /**
       * Writes the specified exception, and message, to a servlet log file.
       * The implementation of this method should call
       * <code>log(msg, exception)</code> instead.  This method is deprecated
       * in the ServletContext interface, but not deprecated here to avoid
       * many useless compiler warnings.
       *
       * @param exception An <code>Exception</code> to be reported
       * @param msg The associated message string
       */
      public void log(Exception exception, String msg) {
  
  	log(msg, exception);
  
      }
  
  
      /**
       * Writes an explanatory message and a stack trace for a given
       * <code>Throwable</code> exception to the servlet log file.  The name
       * and type of the servlet log file is specific to the servlet container,
       * usually an event log.
       *
       * @param msg A <code>String</code> that describes the error or
       *  exception
       * @param throwable The <code>Throwable</code> error or exception
       */
      public void log(String msg, Throwable throwable) {
  
  	CharArrayWriter buf = new CharArrayWriter();
  	PrintWriter writer = new PrintWriter(buf);
  	writer.print(msg);
  	throwable.printStackTrace(writer);
  	log(buf.toString());
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/SystemErrLogger.java
  
  Index: SystemErrLogger.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/SystemErrLogger.java,v
1.1 2000/01/20 06:36:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/01/20 06:36:29 $
   *
   * ====================================================================
   *
   * 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
   * 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", "Tomcat", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.logger;
  
  
  /**
   * Simple implementation of <b>Logger</b> that writes to System.err.
   * Because this component is so simple, no configuration is required.
   * Therefore, Lifecycle is not implemented.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/01/20 06:36:29 $
   */
  
  public final class SystemErrLogger
      extends LoggerBase {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The descriptive information about this implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.logger.SystemErrLogger/1.0";
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Writes the specified message to a servlet log file, usually an event
       * log.  The name and type of the servlet log is specific to the
       * servlet container.
       *
       * @param msg A <code>String</code> specifying the message to be written
       *  to the log file
       */
      public void log(String msg) {
  
  	System.err.println(msg);
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/SystemOutLogger.java
  
  Index: SystemOutLogger.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/SystemOutLogger.java,v
1.1 2000/01/20 06:36:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/01/20 06:36:29 $
   *
   * ====================================================================
   *
   * 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
   * 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", "Tomcat", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  
  package org.apache.tomcat.logger;
  
  
  /**
   * Simple implementation of <b>Logger</b> that writes to System.out.
   * Because this component is so simple, no configuration is required.
   * Therefore, Lifecycle is not implemented.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/01/20 06:36:29 $
   */
  
  public final class SystemOutLogger
      extends LoggerBase {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The descriptive information about this implementation.
       */
      protected static final String info =
  	"org.apache.tomcat.logger.SystemOutLogger/1.0";
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Writes the specified message to a servlet log file, usually an event
       * log.  The name and type of the servlet log is specific to the
       * servlet container.
       *
       * @param msg A <code>String</code> specifying the message to be written
       *  to the log file
       */
      public void log(String msg) {
  
  	System.out.println(msg);
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  fileLogger.alreadyConfigured=File Logger has already been configured
  fileLogger.alreadyStarted=File Logger has already been started
  fileLogger.notConfigured=File Logger has not yet been configured
  fileLogger.notStarted=File Logger has not yet been started
  
  
  

Mime
View raw message