diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java index c1f42baa85e..f6ce23a42eb 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/Log.java @@ -20,6 +20,8 @@ import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import org.eclipse.jetty.util.IO; @@ -59,6 +61,8 @@ public class Log */ public static boolean __ignored; + public static Map __loggers = new HashMap(); + static { /* Instantiate a default configuration properties (empty) @@ -418,6 +422,26 @@ public class Log if (!initialized()) return null; - return name == null ? LOG : LOG.getLogger(name); + if(name==null) + return LOG; + + Logger logger = __loggers.get(name); + if(logger==null) + { + logger = LOG.getLogger(name); + __loggers.put(name,logger); + } + + return logger; + } + + /** + * Get a map of all configured {@link Logger} instances. + * + * @return a map of all configured {@link Logger} instances + */ + public static Map getLoggers() + { + return __loggers; } }