1 2 17 18 19 package org.apache.poi.util; 20 21 import java.io.FileInputStream ; 22 import java.io.IOException ; 23 24 import java.util.*; 25 26 34 35 public class POILogFactory 36 { 37 38 private static Map _loggers = new HashMap();; 40 41 42 45 46 private POILogFactory() 47 { 48 } 49 50 57 58 public static POILogger getLogger(final Class theclass) 59 { 60 return getLogger(theclass.getName()); 61 } 62 63 70 71 public static POILogger getLogger(final String cat) 72 { 73 POILogger logger = null; 74 75 if (_loggers.containsKey(cat)) 76 { 77 logger = ( POILogger ) _loggers.get(cat); 78 } 79 else 80 { 81 try{ 82 String loggerClassName = System.getProperty("org.apache.poi.util.POILogger"); 83 Class loggerClass = Class.forName(loggerClassName); 84 logger = ( POILogger ) loggerClass.newInstance(); 85 } 86 catch(Exception e){ 87 88 logger = new NullLogger(); 89 } 90 91 logger.initialize(cat); 92 93 _loggers.put(cat, logger); 94 } 95 return logger; 96 } 97 98 } | Popular Tags |