1 22 package org.jboss.util; 23 24 import org.apache.avalon.framework.configuration.Configuration; 25 import org.apache.avalon.framework.configuration.ConfigurationException; 26 import org.apache.avalon.framework.logger.Logger; 27 import org.apache.avalon.framework.logger.Log4JLogger; 28 import org.jacorb.config.LoggerFactory; 29 import org.jboss.logging.log4j.Log4jLoggerPlugin; 30 31 import java.util.HashMap ; 32 import java.util.Map ; 33 34 41 public class Log4jLoggerFactory 42 implements LoggerFactory 43 { 44 45 private final static String name = "log4j"; 46 47 48 private final Map namedLoggers = new HashMap (); 49 50 52 58 private static org.apache.log4j.Logger getLog4jLogger(String name) 59 { 60 org.jboss.logging.Logger l = org.jboss.logging.Logger.getLogger(name); 61 org.jboss.logging.LoggerPlugin lp = l.getLoggerPlugin(); 62 if (lp instanceof Log4jLoggerPlugin) 63 return ((Log4jLoggerPlugin)lp).getLogger(); 64 else 65 { 66 return null; 67 } 68 } 69 70 71 73 public void configure(Configuration configuration) 74 throws ConfigurationException 75 { 76 } 77 78 80 85 public final String getLoggingBackendName() 86 { 87 return name; 88 } 89 90 97 public Logger getNamedLogger(String name) 98 { 99 Object o = namedLoggers.get(name); 100 101 if (o != null) 102 return (Logger)o; 103 104 org.apache.log4j.Logger log4jLogger = getLog4jLogger(name); 105 Logger logger = new Log4JLogger(log4jLogger); 106 107 namedLoggers.put(name, logger); 108 return logger; 109 } 110 111 118 public Logger getNamedRootLogger(String name) 119 { 120 return getNamedLogger(name); 121 } 122 123 134 public Logger getNamedLogger(String name, 135 String logFileName, long maxLogSize) 136 throws java.io.IOException 137 { 138 return null; 139 } 140 141 144 public void setDefaultLogFile(String fileName, long maxLogSize) 145 throws java.io.IOException 146 { 147 } 149 150 } 151 | Popular Tags |