cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-08-20 Thread costin

costin  01/08/20 21:58:51

  Modified:src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Update for the fix in util.log
  
  Revision  ChangesPath
  1.14  +6 -1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- LogSetter.java2001/08/12 02:11:09 1.13
  +++ LogSetter.java2001/08/21 04:58:51 1.14
  @@ -287,7 +287,12 @@
   /** Adapter and registry for QueueLoggers
*/
   static class TomcatLogManager extends LogManager {
  -
  + TomcatLogManager() {
  + // can't be changed after this
  + LogManager olm=Log.setLogManager( this ); 
  + this.loggers=olm.getLoggers();
  + this.channels=olm.getChannels();
  + }
   
   }
   
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-03-09 Thread larryi

larryi  01/03/09 13:39:32

  Modified:src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Update to set the default ServletLog for a Context if it hasn't been set
  already.  Defaulting provided in Context, defaults ServletLog output to the
  main Context log.
  
  Revision  ChangesPath
  1.10  +12 -0 
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LogSetter.java2001/03/02 04:49:13 1.9
  +++ LogSetter.java2001/03/09 21:39:32 1.10
  @@ -261,6 +261,18 @@
   
   }
   
  +/** Set default ServletLog for Context if necessary
  + */
  +
  +public void addContext( ContextManager cm, Context ctx )
  + throws TomcatException
  +{
  + if( "org/apache/tomcat/facade".equals( name ) &&
  + ctx.getServletLog() == null ) {
  + ctx.setServletLog( Log.getLog( name, ctx.getId() ) );
  + }
  +}
  +
   /** Adapter and registry for QueueLoggers
*/
   static class TomcatLogManager extends LogManager {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-02-05 Thread costin

costin  01/02/05 22:42:28

  Modified:src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Added the missing options for removing and configuring timestamps.
  
  Revision  ChangesPath
  1.6   +21 -1 
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogSetter.java2001/02/03 07:34:41 1.5
  +++ LogSetter.java2001/02/06 06:42:28 1.6
  @@ -140,6 +140,8 @@
   String path;
   String verbosityLevel;
   boolean servletLogger=false;
  +boolean timestamps=true;
  +String tsFormat=null;
   
   public LogSetter() {
   }
  @@ -165,6 +167,20 @@
   public void setServletLogger( boolean b ) {
servletLogger=b;
   }
  +
  +/** Display the time of the event ( log ).
  + */
  +public void setTimestamps( boolean b ) {
  + timestamps=b;
  +}
  +
  +/** Set the format of the timestamp.
  + "msec" will display the raw time ( fastest ),
  + otherwise a SimpleDateFormat.
  +*/
  +public void setTimestampFormat( String s ) {
  + tsFormat=s;
  +}
   
   /**
*  The log will be added and opened as soon as the module is
  @@ -205,7 +221,11 @@
// construct a queue logger
QueueLogger ql=new QueueLogger();
ql.setName(name);
  -
  + if( ! timestamps )
  + ql.setTimestamp( "false" );
  + if( tsFormat!=null )
  + ql.setTimestampFormat( tsFormat );
  + 
if( path!=null )
ql.setPath(path);
if( verbosityLevel!= null )
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-02-02 Thread costin

costin  01/02/02 23:34:41

  Modified:src/share/org/apache/tomcat/core Context.java
   src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Ops, made a mistake - the context modules can't be initialized
  before the context is added - since there is no context manager.
  
  Also added some comments about the fact that the only tested
  mode is: create context, add modules to it, add it to the server.
  Adding/removing modules at run time may work, but it's not
  supported or tested.
  
  Revision  ChangesPath
  1.137 +24 -2 jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.136
  retrieving revision 1.137
  diff -u -r1.136 -r1.137
  --- Context.java  2001/02/03 07:08:00 1.136
  +++ Context.java  2001/02/03 07:34:41 1.137
  @@ -482,8 +482,18 @@
throws TomcatException
   {
if(this.state==STATE_NEW && state==STATE_ADDED ) {
  + // we are just beeing added
BaseInterceptor cI[]=getContainer().getInterceptors();
for( int i=0; i< cI.length; i++ ) {
  + if( cI[i].getContext() != this )
  + continue; // not ours, don't have to initialize it.
  + cI[i].addInterceptor( contextM, this , cI[i] ); 
  + BaseInterceptor existingI[]=defaultContainer.getInterceptors();
  + for( int j=0; j0) 
  + log( "Constructing logger " + name + " " + path + " " + ctx );

// construct a queue logger
QueueLogger ql=new QueueLogger();
  @@ -218,7 +219,7 @@
// this will be the Log interface to the log we just created
// ( the way logs and channels are created is a bit
// complicated - work for later )
  - cm.setLog( Log.getLog( name, "ContextManager");
  + cm.setLog( Log.getLog( name, "ContextManager"));
}
   
if( ctx!=null ) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-02-02 Thread costin

costin  01/02/02 21:36:25

  Modified:src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Finishing the LogSetter.
  
  - The name of the log will be a full path ( org/apache/tomcat, etc )
  instead of tc_log
  
  - add a log message ( until we're sure everything works as we want )
  
  - register and open the logger ( used to be the hack in DefaultCMSetter)
  
  - explicitely set the Context log or the servlet log.
  
  ( there are few associated changes in CM, Context and BaseInterceptor -
  next commit )
  
  Revision  ChangesPath
  1.4   +46 -9 
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LogSetter.java2001/02/01 06:41:16 1.3
  +++ LogSetter.java2001/02/03 05:36:24 1.4
  @@ -66,9 +66,7 @@
   import java.net.*;
   import java.util.*;
   
  -/**
  -  Add a Logger.
  -  
  +/*
 Logging in Tomcat is quite flexible; we can either have a log
 file per module (example: ContextManager) or we can have one
 for Servlets and one for Jasper, or we can just have one
  @@ -121,7 +119,21 @@
 Some components accept a "debug" attribute.  This further
 enhances log output.  If you set the "debug" level for a
 component, it may output extra debugging information.
  +*/
  +
   
  +/**
  + *  Define a logger with the specified name, using the logger
  + *  implementation in org.apache.tomcat.util.log.QueueLogger
  + *
  + *  Tomcat uses the util.log.Log class - if you want to use
  + *  a different logger ( like log4j or jsrXXX ) you need to create a
  + *  new interceptor that will use your favorite logger and
  + *  create a small adapter ( class extending Log and directing
  + *  the output to your favorite logger.
  + *
  + *  The only contract used in tomcat for logging is the util.Log.
  + * 
*/
   public class LogSetter extends  BaseInterceptor {
   String name;
  @@ -164,14 +176,33 @@
   {
if( module!=this ) return;
   
  + if( name==null ) {
  + if( servletLogger )
  + name="org/apache/tomcat/facade";
  + else
  + name="org/apache/tomcat/core";
  + }
  +
if( path!=null && ! FileUtil.isAbsolute( path ) ) {
File wd= new File(cm.getHome(), path);
path= wd.getAbsolutePath();
}
  + 
  + // workarounds for legacy log names
  + if( "tc_log".equals( name ) )
  + name="org/apache/tomcat/core";
  + if( servletLogger || "servlet_log".equals( name ) )
  + name="org/apache/tomcat/facade";
  +
  + if( ctx != null ) {
  + // this logger is local to a context
  + name=name +  "/"  + ctx.getId();
  + }
   
  + log( "Constructing logger " + name + " " + path + " " + ctx );
  + 
  + // construct a queue logger
QueueLogger ql=new QueueLogger();
  - if( name==null )
  - throw new TomcatException( "Invalid name for logger " );
ql.setName(name);
   
if( path!=null )
  @@ -181,14 +212,20 @@
   
ql.open();
   
  - //  if( debug>-1) log("Adding logger " + name + " " + servletLogger + " " 
+ ctx );
  - cm.addLogger( ql );
  + Logger.putLogger( ql );
  +
  + if( "org/apache/tomcat/core".equals( name ) ) {
  + // this will be the Log interface to the log we just created
  + // ( the way logs and channels are created is a bit
  + // complicated - work for later )
  + cm.setLog( Log.getLog( name, "ContextManager");
  + }
   
if( ctx!=null ) {
if( servletLogger ) {
  - ctx.setServletLogger( ql );
  + ctx.setServletLog( Log.getLog( name, ctx.getId() ) );
} else {
  - ctx.setLogger( ql );
  + ctx.setLog( Log.getLog( name, ctx.getId() ) );
}
}  
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-01-31 Thread costin

costin  01/01/31 22:08:48

  Modified:src/etc  server.xml
   src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  Replaced  with the LogSetter, now everything works the same way
  without any special hacks.
  
  The comments on logging moved to the LogSetter - I'll also migrate
  more of the comments from server.xml to the modules.
  The idea is that module documentation ( that should be located in
  modules themself - or in the user documentation ) should be part of
  the docs, not in xml comments. server.xml might get re-generated by
  tools and the comments are hard to preserve.
  
  We can add an explicit description="..." to each module, to explain
  what it's doing, but I don't think server.xml is the right user documentation
  
  ( if we decide to use it as user doc, we should add comments for all
  modules )
  
  ( also fixed the class name in LogSetter - bad commit )
  
  Revision  ChangesPath
  1.64  +27 -97jakarta-tomcat/src/etc/server.xml
  
  Index: server.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- server.xml2001/01/28 21:30:35 1.63
  +++ server.xml2001/02/01 06:08:48 1.64
  @@ -1,88 +1,5 @@
   
  -
  -
   
  -  
  -
  -  
  -
  -
  -
  -
  -
  -
  -
   
   
  -
  +
  +
  +
  +
  +
  +
  +
  +verbosityLevel = "INFORMATION"  />
   
   

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-01-31 Thread costin

costin  01/01/31 22:41:16

  Modified:src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  NPE - path can be null ( for console output ).
  
  Note that per/context interceptors are not working right now, I'll
  have them restored tommorow night. I also have to commit the fix
  to the original problem ( war expansion broken ).
  
  Revision  ChangesPath
  1.3   +2 -1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogSetter.java2001/02/01 06:08:48 1.2
  +++ LogSetter.java2001/02/01 06:41:16 1.3
  @@ -164,7 +164,7 @@
   {
if( module!=this ) return;
   
  - if( ! FileUtil.isAbsolute( path ) ) {
  + if( path!=null && ! FileUtil.isAbsolute( path ) ) {
File wd= new File(cm.getHome(), path);
path= wd.getAbsolutePath();
}
  @@ -181,6 +181,7 @@
   
ql.open();
   
  + //  if( debug>-1) log("Adding logger " + name + " " + servletLogger + " " 
+ ctx );
cm.addLogger( ql );
   
if( ctx!=null ) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config LogSetter.java

2001-01-31 Thread costin

costin  01/01/31 21:43:00

  Added:   src/share/org/apache/tomcat/modules/config LogSetter.java
  Log:
  The module will set up the loggers - should replace the hacks in
  configuration, and maybe allow us to plug a different logger later
  ( like log4j ).
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LogSetter.java
  
  Index: LogSetter.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
   * .
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.tomcat.modules.config;
  
  import org.apache.tomcat.core.*;
  import org.apache.tomcat.util.log.*;
  import org.apache.tomcat.util.FileUtil;
  import java.io.*;
  import java.net.*;
  import java.util.*;
  
  /**
Add a Logger.

Logging in Tomcat is quite flexible; we can either have a log
file per module (example: ContextManager) or we can have one
for Servlets and one for Jasper, or we can just have one
tomcat.log for both Servlet and Jasper.  Right now there are
three standard log streams, "tc_log", "servlet_log", and
"JASPER_LOG".  

Path: 

The file to which to output this log, relative to
TOMCAT_HOME.  If you omit a "path" value, then stderr or
stdout will be used.

Verbosity: 

Threshold for which types of messages are displayed in the
log.  Levels are inclusive; that is, "WARNING" level displays
any log message marked as warning, error, or fatal.  Default
level is WARNING.  Note: servlet_log must be level
INFORMATION in order to see normal servlet log messages.

verbosityLevel values can be: 
FATAL
ERROR
WARNING 
INFORMATION
DEBUG
  
Timestamps:

By default, logs print a timestamp in the form "-MM-dd
hh:mm:ss" in front of each message.  To disable timestamps
completely, set 'timestamp="no"'. To use the raw
msec-since-epoch, which is more efficient, set
'timestampFormat="msec"'.  If you want a custom format, you
can use 'timestampFormat="hh:mm:ss"' following the syntax of
java.text.SimpleDateFormat (see Javadoc API).  For a
production environment, we recomm