Return-Path: Mailing-List: contact log4j-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list log4j-user@jakarta.apache.org Received: (qmail 3916 invoked from network); 5 Jan 2001 23:06:16 -0000 Received: from adsl-63-197-150-84.dsl.snfc21.pacbell.net (HELO mail.nelson.monkey.org) (identdIsStupid@63.197.150.84) by h31.sny.collab.net with SMTP; 5 Jan 2001 23:06:16 -0000 Received: (from nelson@localhost) by mail.nelson.monkey.org (8.9.3/8.9.3) id PAA15455; Fri, 5 Jan 2001 15:06:07 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14934.21343.294602.931342@syrah.nelson.monkey.org> Date: Fri, 5 Jan 2001 15:06:07 -0800 (PST) From: nelson@monkey.org (Nelson Minar) To: "LOG4J Users Mailing List" Subject: Re: use of log4j with servlet In-Reply-To: References: X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N >Is there a way to detect if a BasicConfigurator is already configurate ? As a bunch of folks have said; no, not really. One option is to use a special startup class that your servlet engine invokes. I don't know if there's a standard way to do this in the servlet API; some engines will invoke any given class you ask it to, others will run a specially designated "startup servlet". Another option is to encapsulate your initialization of log4j in your own static class. Ie, a class like this: public class LoggingInitializer extends Object { private static boolean initialized = false; public static void initialize() { if (initialized) return; BasicConfigurator.configure(...); } } Then just invoke your initialize method. Not super-efficient, but it works fine. And you will probably find later that having all initialization centralized in one class simplifies your life when you start initializing log4j in a more complex way.