--- orig/James.java 2006-09-17 02:55:48.000000000 +0200 +++ patch/James.java 2006-09-17 03:09:13.000000000 +0200 @@ -78,6 +78,7 @@ import java.util.Map; import java.util.Vector; import java.lang.StackTraceElement; +import java.util.HashMap; /** * Core class for JAMES. Provides three primary services: @@ -187,6 +188,12 @@ protected Mailet localDeliveryMailet; /** + * Add-on for getChildsLogger from anywhere + */ + protected static Logger mainLog = null; + protected static final HashMap childLoggers = new HashMap(); + + /** * @see org.apache.avalon.framework.context.Contextualizable#contextualize(Context) */ public void contextualize(final Context context) { @@ -202,10 +209,22 @@ } /** + * Add-on for getChildsLogger from anywhere + */ + public synchronized static Logger getChildLogger(String name) { + Logger log = (Logger)childLoggers.get(name); + if (log == null) { + log = mainLog.getChildLogger(name); + childLoggers.put(name, log); + } + return log; + } + /** * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) */ public void configure(Configuration conf) { this.conf = conf; + mainLog = getLogger(); } /**