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

CommonLogHandler

public class CommonLogHandler extends LogHandler
Log using common-logging.
author
Costin Manolache

Fields Summary
private Hashtable
loggers
Constructors Summary
Methods Summary
public synchronized voidclose()
Close the log.

	// Nothing - commons logging doesn't have the notion
    
public voidflush()
Flush the log.

	// Nothing - commons logging doesn't have the notion
    
public voidlog(java.lang.String prefix, java.lang.String msg, java.lang.Throwable t, int verbosityLevel)
Prints log message and stack trace. This method should be overriden by real logger implementations

param
prefix optional prefix.
param
message the message to log.
param
t the exception that was thrown.
param
verbosityLevel what type of message is this? (WARNING/DEBUG/INFO etc)

    
                    			   			     			     		      				      
           
		     
    
        if( prefix==null ) prefix="tomcat";

        com.sun.org.apache.commons.logging.Log l=(com.sun.org.apache.commons.logging.Log)loggers.get( prefix );
        if( l==null ) {
            l=LogFactory.getLog( prefix );
            loggers.put( prefix, l );
        }
        
	if( verbosityLevel > this.level ) return;

        if( t==null ) {
            if( verbosityLevel == Log.FATAL )
                l.fatal(msg);
            else if( verbosityLevel == Log.ERROR )
                l.error( msg );
            else if( verbosityLevel == Log.WARNING )
                l.warn( msg );
            else if( verbosityLevel == Log.INFORMATION)
                l.info( msg );
            else if( verbosityLevel == Log.DEBUG )
                l.debug( msg );
        } else {
            if( verbosityLevel == Log.FATAL )
                l.fatal(msg, t);
            else if( verbosityLevel == Log.ERROR )
                l.error( msg, t );
            else if( verbosityLevel == Log.WARNING )
                l.warn( msg, t );
            else if( verbosityLevel == Log.INFORMATION)
                l.info( msg, t );
            else if( verbosityLevel == Log.DEBUG )
                l.debug( msg, t );
        }