FileDocCategorySizeDatePackage
LogManager.javaAPI DocGlassfish v2 API3855Fri May 04 22:33:16 BST 2007org.apache.tomcat.util.log

LogManager

public class LogManager extends Object
Allows the control the log properties at runtime. Normal applications will just use Log, without having to deal with the way the log is configured or managed.
author
Alex Chaffee [alex@jguru.com]
author
Costin Manolache

Fields Summary
static LogHandler
defaultChannel
protected Hashtable
loggers
protected Hashtable
channels
private static int
dL
Constructors Summary
Methods Summary
public voidaddChannel(java.lang.String name, LogHandler logH)

	if(name==null) name="";

	channels.put( name, logH );
	Enumeration enumeration=loggers.keys();
	while( enumeration.hasMoreElements() ) {
	    String k=(String)enumeration.nextElement();
	    Log l=(Log)loggers.get( k );
	    if( name.equals( l.getChannel( this ) )) {
		l.setProxy( this, logH );
	    }
	}
    
public java.util.HashtablegetChannels()

	return channels;
    
public LoggetLog(java.lang.String channel, java.lang.String prefix, java.lang.Object owner)
Default method to create a log facade.

	if( prefix==null && owner!=null ) {
	    String cname = owner.getClass().getName();
	    prefix = cname.substring( cname.lastIndexOf(".") +1);
	}

	LogHandler proxy=(LogHandler)channels.get(channel);
	if( proxy==null ) proxy=defaultChannel;
	
	// user-level loggers
	Log log=new Log( channel, prefix, proxy, owner );
	loggers.put( channel + ":" + prefix, log );
	if( dL > 0 )
	    System.out.println("getLog facade " + channel + ":" + prefix);
	return log;
    
public java.util.HashtablegetLoggers()


        
	return loggers;
    
public static voidsetDefault(LogHandler l)

	if( defaultChannel==null)
	    defaultChannel=l;