costin 00/12/05 15:31:16 Modified: src/share/org/apache/tomcat/util/log QueueLogger.java Added: src/share/org/apache/tomcat/util/log LogEntry.java Log: Small change in util.log - expose the LogEntry. I'm going to do another set of small changes to clean up the way loggers are set up and maintained in ContextManager. Among the changes, I would like to split Logger in LogManager and LogHandler, use the package name to identify loggers. Probably I'll try few performance enhancements ( recycle and pool LogEntry, re-add the optional XML output format, try to make the interfaces similar to the javax.logging so we can easily switch when the spec will be available) I'll also try to port back the AccessLogValve. ( all this is low-priority, finishing the core is the most important thing) Revision Changes Path 1.2 +3 -44 jakarta-tomcat/src/share/org/apache/tomcat/util/log/QueueLogger.java Index: QueueLogger.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/log/QueueLogger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- QueueLogger.java 2000/09/29 14:33:37 1.1 +++ QueueLogger.java 2000/12/05 23:31:16 1.2 @@ -126,47 +126,6 @@ public String toString() { return "QueueLogger(" + getName() + ", " + getPath() + ")"; } - - - /** - * This is an entry that is created in response to every - * Logger.log(...) call. - */ - public final class LogEntry { - String logName; - long date=0; - String message; - Throwable t; - QueueLogger l; - - LogEntry(QueueLogger l, long date, String message, Throwable t) { - this.date = date; - this.message = message; - this.t = t; - this.l=l; - } - - LogEntry( QueueLogger l, String message, Throwable t) { - this.message = message; - this.t = t; - this.l=l; - } - - public void print( StringBuffer outSB) { - if (date!=0) { - formatTimestamp( date, outSB ); - outSB.append(" - "); - } - - if (message != null) - outSB.append(message); - - if (t != null) { - outSB.append(" - "); - outSB.append(throwableToString( t )); - } - } - } } /** * The daemon thread that looks in a queue and if it is not empty @@ -191,8 +150,8 @@ private void emptyQueue() { do { - QueueLogger.LogEntry logEntry = - (QueueLogger.LogEntry) logQueue.pull(); + LogEntry logEntry = + (LogEntry) logQueue.pull(); QueueLogger tl=logEntry.l; Writer writer=tl.sink; if (writer != null) { @@ -216,7 +175,7 @@ } } while (!LogDaemon.this.logQueue.isEmpty()); } - + public void run() { while (true) { emptyQueue(); 1.1 jakarta-tomcat/src/share/org/apache/tomcat/util/log/LogEntry.java Index: LogEntry.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 [EMAIL PROTECTED] * * 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.tomcat.util.log; import java.io.Writer; import java.io.StringWriter; import java.io.PrintWriter; import java.util.Date; import org.apache.tomcat.util.Queue; /** * This is an entry that is created in response to every * Logger.log(...) call. * * @author Anil V ([EMAIL PROTECTED]) * @since Tomcat 3.1 */ public final class LogEntry { String logName; long date=0; String message; Throwable t; QueueLogger l; LogEntry(QueueLogger l, long date, String message, Throwable t) { this.date = date; this.message = message; this.t = t; this.l=l; } LogEntry( QueueLogger l, String message, Throwable t) { this.message = message; this.t = t; this.l=l; } // XXX should move to LogFormat !!! public void print( StringBuffer outSB) { if (date!=0) { l.formatTimestamp( date, outSB ); outSB.append(" - "); } if (message != null) outSB.append(message); if (t != null) { outSB.append(" - "); outSB.append(l.throwableToString( t )); } } }