FileDocCategorySizeDatePackage
POILogFactory.javaAPI DocApache Poi 3.0.12754Mon Jan 01 12:39:42 GMT 2007org.apache.poi.util

POILogFactory

public class POILogFactory extends Object
Provides logging without clients having to mess with configuration/initialization.
author
Andrew C. Oliver (acoliver at apache dot org)
author
Marc Johnson (mjohnson at apache dot org)
author
Nicola Ken Barozzi (nicolaken at apache.org)

Fields Summary
private static Map
_loggers
Constructors Summary
private POILogFactory()
construct a POILogFactory.



            

     
    
    
Methods Summary
public static org.apache.poi.util.POILoggergetLogger(java.lang.Class theclass)
Get a logger, based on a class name

param
theclass the class whose name defines the log
return
a POILogger for the specified class

        return getLogger(theclass.getName());
    
public static org.apache.poi.util.POILoggergetLogger(java.lang.String cat)
Get a logger, based on a String

param
cat the String that defines the log
return
a POILogger for the specified class

        POILogger logger = null;

        if (_loggers.containsKey(cat))
        {
            logger = ( POILogger ) _loggers.get(cat);
        }
        else
        {
            try{
              String loggerClassName = System.getProperty("org.apache.poi.util.POILogger");
              Class loggerClass = Class.forName(loggerClassName);
              logger = ( POILogger ) loggerClass.newInstance();
            }
            catch(Exception e){
            
              logger = new NullLogger();
            }
            
            logger.initialize(cat);
            
            _loggers.put(cat, logger);
        }
        return logger;