1 21 22 package org.jacorb.notification.util; 23 24 import org.apache.avalon.framework.configuration.ConfigurationException; 25 import org.apache.avalon.framework.logger.LogKitLogger; 26 import org.apache.avalon.framework.logger.Logger; 27 import org.apache.log.Hierarchy; 28 29 33 public class LogUtil 34 { 35 private static org.jacorb.config.Configuration sConfiguration_; 36 37 public static Logger getLogger(org.apache.avalon.framework.configuration.Configuration config, String name) 38 { 39 try { 40 return ((org.jacorb.config.Configuration)config).getNamedLogger(name); 41 } catch (ClassCastException e) 42 { 43 return getLogger(name); 44 } 45 } 46 47 public static Logger getLogger(String name) 48 { 49 try 50 { 51 if (sConfiguration_ == null) 52 { 53 sConfiguration_ = org.jacorb.config.Configuration.getConfiguration(null, null, false); 54 } 55 56 return sConfiguration_.getNamedLogger(name); 57 } catch (ConfigurationException e) 58 { 59 return new LogKitLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(name)); 60 } 61 } 62 } | Popular Tags |